123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- #ifndef BOOST_CONTAINER_USES_ALLOCATOR_HPP
- #define BOOST_CONTAINER_USES_ALLOCATOR_HPP
- #include <boost/container/uses_allocator_fwd.hpp>
- #include <boost/container/detail/type_traits.hpp>
- namespace boost {
- namespace container {
- template <class T>
- struct constructible_with_allocator_suffix
- { static const bool value = false; };
- template <class T>
- struct constructible_with_allocator_prefix
- { static const bool value = false; };
- #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
- namespace dtl {
- template<typename T, typename Allocator>
- struct uses_allocator_imp
- {
-
-
- private:
- typedef char yes_type;
- struct no_type{ char dummy[2]; };
-
-
- template <class U>
- static yes_type test(typename U::allocator_type);
-
- template <class U, class V>
- static typename dtl::enable_if
- < dtl::is_same<typename U::allocator_type, erased_type>
- , yes_type
- >::type test(const V&);
-
-
- template <typename U>
- static no_type test(...);
- static Allocator alloc;
- public:
- static const bool value = sizeof(test<T>(alloc)) == sizeof(yes_type);
- };
- }
- #endif
- template <typename T, typename Allocator>
- struct uses_allocator
- : dtl::uses_allocator_imp<T, Allocator>
- {};
- }}
- #endif
|