Allocates memory for an array of count elements. Throws bad_alloc if there is no enough memory
| 153 | //!Allocates memory for an array of count elements. |
| 154 | //!Throws bad_alloc if there is no enough memory |
| 155 | pointer allocate(size_type count) |
| 156 | { |
| 157 | const std::size_t max_count = std::size_t(-1)/(2*sizeof(T)); |
| 158 | if(BOOST_UNLIKELY(count > max_count)) |
| 159 | throw_bad_alloc(); |
| 160 | return static_cast<T*>(::operator new(count*sizeof(T))); |
| 161 | } |
| 162 | |
| 163 | //!Deallocates previously allocated memory. |
| 164 | //!Never throws |
no test coverage detected