////////////////////////////////////////////////////////////////////////////// // // (C) Copyright 2011-2012 Vicente J. Botet Escriba // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/thread for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_THREAD_DETAIL_MEMORY_HPP #define BOOST_THREAD_DETAIL_MEMORY_HPP #include #include #include #include #include #include #include #include #include namespace boost { namespace thread_detail { template class allocator_destructor { typedef container::allocator_traits<_Alloc> alloc_traits; public: typedef typename alloc_traits::pointer pointer; typedef typename alloc_traits::size_type size_type; private: _Alloc alloc_; size_type s_; public: allocator_destructor(_Alloc& a, size_type s)BOOST_NOEXCEPT : alloc_(a), s_(s) {} void operator()(pointer p)BOOST_NOEXCEPT { alloc_traits::destroy(alloc_, p); alloc_traits::deallocate(alloc_, p, s_); } }; } //namespace thread_detail typedef container::allocator_arg_t allocator_arg_t; BOOST_CONSTEXPR_OR_CONST allocator_arg_t allocator_arg = {}; template struct uses_allocator: public container::uses_allocator { }; template struct pointer_traits { typedef Ptr pointer; // typedef
element_type; // typedef
difference_type; // template using rebind =
; // // static pointer pointer_to(
); }; template struct pointer_traits { typedef T* pointer; typedef T element_type; typedef ptrdiff_t difference_type; // template using rebind = U*; // // static pointer pointer_to(
) noexcept; }; namespace thread_detail { template ::element_type>::type, typename remove_cv::element_type>::type >::value > struct same_or_less_cv_qualified_imp : is_convertible<_Ptr1, _Ptr2> {}; template struct same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false> : false_type {}; template ::value && !is_pointer<_Ptr1>::value> struct same_or_less_cv_qualified : same_or_less_cv_qualified_imp<_Ptr1, _Ptr2> {}; template struct same_or_less_cv_qualified<_Ptr1, _Ptr2, true> : false_type {}; } template struct BOOST_SYMBOL_VISIBLE default_delete { #ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS BOOST_SYMBOL_VISIBLE BOOST_CONSTEXPR default_delete() = default; #else BOOST_SYMBOL_VISIBLE BOOST_CONSTEXPR default_delete() BOOST_NOEXCEPT {} #endif template BOOST_SYMBOL_VISIBLE default_delete(const default_delete&, typename enable_if >::type* = 0) BOOST_NOEXCEPT {} BOOST_SYMBOL_VISIBLE void operator() (T* ptr) const BOOST_NOEXCEPT { BOOST_STATIC_ASSERT_MSG(sizeof(T) > 0, "default_delete can not delete incomplete type"); delete ptr; } }; template struct BOOST_SYMBOL_VISIBLE default_delete { public: #ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS BOOST_SYMBOL_VISIBLE BOOST_CONSTEXPR default_delete() = default; #else BOOST_SYMBOL_VISIBLE BOOST_CONSTEXPR default_delete() BOOST_NOEXCEPT {} #endif template BOOST_SYMBOL_VISIBLE default_delete(const default_delete&, typename enable_if >::type* = 0) BOOST_NOEXCEPT {} template BOOST_SYMBOL_VISIBLE void operator() (U* ptr, typename enable_if >::type* = 0) const BOOST_NOEXCEPT { BOOST_STATIC_ASSERT_MSG(sizeof(T) > 0, "default_delete can not delete incomplete type"); delete [] ptr; } }; } // namespace boost #endif // BOOST_THREAD_DETAIL_MEMORY_HPP