Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. template<typename T>
  2. Array<T>::Array(const size_t _SIZE) : _SIZE(_SIZE), _content(nullptr){
  3. #define __SIZE__ _SIZE
  4. #if (__SIZE__ > 0x7fffffff)
  5. #error Total size of Array must not exceed 0x7fffffff bytes.
  6. #endif
  7. _content = new T[_SIZE];
  8. memset(_content, 0, (sizeof(_content) * _SIZE));
  9. }
  10.  
  11. Array<int> foo(-1) //-1 of size_t = ((2^31)*2)-1 error should be shown since ((2^31)*2)-1 > ((2^31)*2)-1
  12.  
  13. assert(_SIZE <= 0x7fffffff);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement