public:
pointer allocate(size_type n, const void* = 0)
{
- if (n > N - (ptr_ - buf_) / sizeof(value_type))
+ if (n > N - (ptr_ - buf_) / sizeof(value_type)) {
+#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_alloc();
+#else
+ std::terminate();
+#endif
+ }
pointer r = (T*)ptr_;
ptr_ += n * sizeof(T);
return r;
const_pointer address(const_reference x) const {return &x;}
pointer allocate(size_type n, const void* = 0)
{
- if (count >= throw_after)
+ if (count >= throw_after) {
+#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_alloc();
+#else
+ std::terminate();
+#endif
+ }
++count;
return (pointer)std::malloc(n * sizeof(T));
}
const_pointer address(const_reference x) const {return &x;}
pointer allocate(size_type n, const void* = 0)
{
- if (count >= throw_after)
+ if (count >= throw_after) {
+#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_alloc();
+#else
+ std::terminate();
+#endif
+ }
++count;
return (pointer)std::malloc(n * sizeof(T));
}
const_pointer address(const_reference x) const {return &x;}
pointer allocate(size_type n, const void* = 0)
{
- if (count >= throw_after)
+ if (count >= throw_after) {
+#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_alloc();
+#else
+ std::terminate();
+#endif
+ }
++count;
return (pointer)std::malloc(n * sizeof(T));
}
const_pointer address(const_reference x) const {return &x;}
pointer allocate(size_type n, const void* = 0)
{
- if (count >= throw_after)
+ if (count >= throw_after) {
+#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_alloc();
+#else
+ std::terminate();
+#endif
+ }
++count;
return (pointer)std::malloc(n * sizeof(T));
}
const_pointer address(const_reference x) const {return &x;}
pointer allocate(size_type n, const void* = 0)
{
- if (count >= throw_after)
+ if (count >= throw_after) {
+#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_alloc();
+#else
+ std::terminate();
+#endif
+ }
++count;
return (pointer)std::malloc(n * sizeof(T));
}
pointer allocate(size_type n, const void* = 0)
{
assert(data_ >= 0);
- if (time_to_throw >= throw_after)
+ if (time_to_throw >= throw_after) {
+#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_alloc();
+#else
+ std::terminate();
+#endif
+ }
++time_to_throw;
++alloc_count;
return (pointer)std::malloc(n * sizeof(T));