PATH:
opt
/
cpanel
/
ea-ruby27
/
src
/
passenger-release-6.1.2
/
src
/
cxx_supportlib
/
vendor-modified
/
boost
/
core
/* Copyright 2019 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under the Boost Software License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_CORE_DEFAULT_ALLOCATOR_HPP #define BOOST_CORE_DEFAULT_ALLOCATOR_HPP #include <boost/config.hpp> #include <new> #include <cstddef> namespace boost { #if defined(BOOST_NO_EXCEPTIONS) BOOST_NORETURN void throw_exception(const std::exception&); #endif namespace default_ { template<bool V> struct bool_constant { typedef bool value_type; typedef bool_constant type; static const bool value = V; operator bool() const BOOST_NOEXCEPT { return V; } bool operator()() const BOOST_NOEXCEPT { return V; } }; template<bool V> const bool bool_constant<V>::value; template<class T> struct add_reference { typedef T& type; }; template<> struct add_reference<void> { typedef void type; }; template<> struct add_reference<const void> { typedef const void type; }; template<class T> struct default_allocator { typedef T value_type; typedef T* pointer; typedef const T* const_pointer; typedef typename add_reference<T>::type reference; typedef typename add_reference<const T>::type const_reference; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef bool_constant<true> propagate_on_container_move_assignment; typedef bool_constant<true> is_always_equal; template<class U> struct rebind { typedef default_allocator<U> other; }; #if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) default_allocator() = default; #else BOOST_CONSTEXPR default_allocator() BOOST_NOEXCEPT { } #endif template<class U> BOOST_CONSTEXPR default_allocator(const default_allocator<U>&) BOOST_NOEXCEPT { } BOOST_CONSTEXPR std::size_t max_size() const BOOST_NOEXCEPT { return static_cast<std::size_t>(-1) / (2 < sizeof(T) ? sizeof(T) : 2); } #if !defined(BOOST_NO_EXCEPTIONS) T* allocate(std::size_t n) { if (n > max_size()) { throw std::bad_alloc(); } return static_cast<T*>(::operator new(sizeof(T) * n)); } void deallocate(T* p, std::size_t) { ::operator delete(p); } #else T* allocate(std::size_t n) { if (n > max_size()) { boost::throw_exception(std::bad_alloc()); } void* p = ::operator new(sizeof(T) * n, std::nothrow); if (!p) { boost::throw_exception(std::bad_alloc()); } return static_cast<T*>(p); } void deallocate(T* p, std::size_t) { ::operator delete(p, std::nothrow); } #endif #if defined(BOOST_NO_CXX11_ALLOCATOR) T* allocate(std::size_t n, const void*) { return allocate(n); } #endif #if (defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 60000) || \ defined(BOOST_NO_CXX11_ALLOCATOR) template<class U, class V> void construct(U* p, const V& v) { ::new(p) U(v); } template<class U> void destroy(U* p) { p->~U(); (void)p; } #endif }; template<class T, class U> BOOST_CONSTEXPR inline bool operator==(const default_allocator<T>&, const default_allocator<U>&) BOOST_NOEXCEPT { return true; } template<class T, class U> BOOST_CONSTEXPR inline bool operator!=(const default_allocator<T>&, const default_allocator<U>&) BOOST_NOEXCEPT { return false; } } /* default_ */ using default_::default_allocator; } /* boost */ #endif
[-] ref.hpp
[edit]
[-] default_allocator.hpp
[edit]
[-] allocator_access.hpp
[edit]
[-] no_exceptions_support.hpp
[edit]
[-] uncaught_exceptions.hpp
[edit]
[-] invoke_swap.hpp
[edit]
[-] quick_exit.hpp
[edit]
[-] launder.hpp
[edit]
[-] swap.hpp
[edit]
[-] enable_if.hpp
[edit]
[-] first_scalar.hpp
[edit]
[-] memory_resource.hpp
[edit]
[-] make_span.hpp
[edit]
[-] scoped_enum.hpp
[edit]
[-] exchange.hpp
[edit]
[-] cmath.hpp
[edit]
[-] lightweight_test_trait.hpp
[edit]
[-] max_align.hpp
[edit]
[-] demangle.hpp
[edit]
[-] noinit_adaptor.hpp
[edit]
[-] empty_value.hpp
[edit]
[+]
..
[-] underlying_type.hpp
[edit]
[-] null_deleter.hpp
[edit]
[-] data.hpp
[edit]
[-] allocator_traits.hpp
[edit]
[-] is_same.hpp
[edit]
[-] verbose_terminate_handler.hpp
[edit]
[-] fclose_deleter.hpp
[edit]
[-] span.hpp
[edit]
[-] lightweight_test.hpp
[edit]
[-] use_default.hpp
[edit]
[-] alignof.hpp
[edit]
[-] size.hpp
[edit]
[-] checked_delete.hpp
[edit]
[-] typeinfo.hpp
[edit]
[-] nvp.hpp
[edit]
[-] serialization.hpp
[edit]
[-] snprintf.hpp
[edit]
[-] type_name.hpp
[edit]
[-] addressof.hpp
[edit]
[-] explicit_operator_bool.hpp
[edit]
[-] yield_primitives.hpp
[edit]
[-] pointer_in_range.hpp
[edit]
[+]
detail
[-] pointer_traits.hpp
[edit]
[-] identity.hpp
[edit]
[-] alloc_construct.hpp
[edit]
[-] ignore_unused.hpp
[edit]
[-] bit.hpp
[edit]
[-] noncopyable.hpp
[edit]
[-] functor.hpp
[edit]