diff options
Diffstat (limited to 'contrib/libc++/include/experimental/dynarray')
-rw-r--r-- | contrib/libc++/include/experimental/dynarray | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/contrib/libc++/include/experimental/dynarray b/contrib/libc++/include/experimental/dynarray index 4a06908..8c97337 100644 --- a/contrib/libc++/include/experimental/dynarray +++ b/contrib/libc++/include/experimental/dynarray @@ -11,9 +11,6 @@ #ifndef _LIBCPP_DYNARRAY #define _LIBCPP_DYNARRAY -#include <__config> -#if _LIBCPP_STD_VER > 11 - /* dynarray synopsis @@ -96,6 +93,8 @@ public: }} // std::experimental */ +#include <__config> +#if _LIBCPP_STD_VER > 11 #include <__functional_base> #include <iterator> @@ -104,12 +103,6 @@ public: #include <new> #include <algorithm> -#include <__undef___deallocate> - -#if defined(_LIBCPP_NO_EXCEPTIONS) - #include <cassert> -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif @@ -117,7 +110,7 @@ public: namespace std { namespace experimental { inline namespace __array_extensions_v1 { template <class _Tp> -struct _LIBCPP_TYPE_VIS_ONLY dynarray +struct _LIBCPP_TEMPLATE_VIS dynarray { public: // types: @@ -142,19 +135,14 @@ private: static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count ) { if ( numeric_limits<size_t>::max() / sizeof (value_type) <= count ) - { -#ifndef _LIBCPP_NO_EXCEPTIONS - throw bad_array_length(); -#else - assert(!"dynarray::allocation"); -#endif - } + __throw_bad_array_length(); + return static_cast<value_type *> (_VSTD::__allocate (sizeof(value_type) * count)); } - static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept + static inline _LIBCPP_INLINE_VISIBILITY void __deallocate_value( value_type* __ptr ) noexcept { - _VSTD::__deallocate (static_cast<void *> (__ptr)); + _VSTD::__libcpp_deallocate (static_cast<void *> (__ptr)); } public: @@ -274,7 +262,7 @@ dynarray<_Tp>::~dynarray() value_type *__data = data () + __size_; for ( size_t i = 0; i < __size_; ++i ) (--__data)->value_type::~value_type(); - __deallocate ( __base_ ); + __deallocate_value( __base_ ); } template <class _Tp> @@ -283,13 +271,8 @@ typename dynarray<_Tp>::reference dynarray<_Tp>::at(size_type __n) { if (__n >= __size_) - { -#ifndef _LIBCPP_NO_EXCEPTIONS - throw out_of_range("dynarray::at"); -#else - assert(!"dynarray::at out_of_range"); -#endif - } + __throw_out_of_range("dynarray::at"); + return data()[__n]; } @@ -299,13 +282,8 @@ typename dynarray<_Tp>::const_reference dynarray<_Tp>::at(size_type __n) const { if (__n >= __size_) - { -#ifndef _LIBCPP_NO_EXCEPTIONS - throw out_of_range("dynarray::at"); -#else - assert(!"dynarray::at out_of_range"); -#endif - } + __throw_out_of_range("dynarray::at"); + return data()[__n]; } @@ -314,7 +292,7 @@ dynarray<_Tp>::at(size_type __n) const _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp, class _Alloc> -struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {}; +struct _LIBCPP_TEMPLATE_VIS uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {}; _LIBCPP_END_NAMESPACE_STD #endif // if _LIBCPP_STD_VER > 11 |