uses_allocator_fwd.hpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost
  4. // Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/container for documentation.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef BOOST_CONTAINER_USES_ALLOCATOR_FWD_HPP
  11. #define BOOST_CONTAINER_USES_ALLOCATOR_FWD_HPP
  12. #include <boost/container/detail/workaround.hpp>
  13. #include <boost/container/detail/std_fwd.hpp>
  14. //! \file
  15. //! This header forward declares boost::container::constructible_with_allocator_prefix,
  16. //! boost::container::constructible_with_allocator_suffix and
  17. //! boost::container::uses_allocator. Also defines the following types:
  18. namespace boost {
  19. namespace container {
  20. #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  21. template <int Dummy = 0>
  22. struct std_allocator_arg_holder
  23. {
  24. static ::std::allocator_arg_t *dummy;
  25. };
  26. template <int Dummy> //Silence null-reference compiler warnings
  27. ::std::allocator_arg_t *std_allocator_arg_holder<Dummy>::dummy = reinterpret_cast< ::std::allocator_arg_t * >(0x1234);
  28. typedef const std::allocator_arg_t & allocator_arg_t;
  29. #else
  30. //! The allocator_arg_t struct is an empty structure type used as a unique type to
  31. //! disambiguate constructor and function overloading. Specifically, several types
  32. //! have constructors with allocator_arg_t as the first argument, immediately followed
  33. //! by an argument of a type that satisfies Allocator requirements
  34. typedef unspecified allocator_arg_t;
  35. #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  36. //! The `erased_type` struct is an empty struct that serves as a placeholder for a type
  37. //! T in situations where the actual type T is determined at runtime. For example,
  38. //! the nested type, `allocator_type`, is an alias for `erased_type` in classes that
  39. //! use type-erased allocators.
  40. struct erased_type {};
  41. //! A instance of type
  42. //! allocator_arg_t
  43. static allocator_arg_t allocator_arg = BOOST_CONTAINER_DOC1ST(unspecified, *std_allocator_arg_holder<>::dummy);
  44. // @cond
  45. template <class T>
  46. struct constructible_with_allocator_suffix;
  47. template <class T>
  48. struct constructible_with_allocator_prefix;
  49. template <typename T, typename Allocator>
  50. struct uses_allocator;
  51. // @endcond
  52. }} // namespace boost { namespace container {
  53. #endif //BOOST_CONTAINER_USES_ALLOCATOR_HPP