예제 #1
0
template<class T, std::size_t N>
class static_storage_allocator
{
   public:
   typedef T value_type;

   static_storage_allocator() BOOST_CONTAINER_NOEXCEPT
   {}

   static_storage_allocator(const static_storage_allocator &) BOOST_CONTAINER_NOEXCEPT
   {}

   static_storage_allocator & operator=(const static_storage_allocator &) BOOST_CONTAINER_NOEXCEPT
   {}

   T* internal_storage() const BOOST_CONTAINER_NOEXCEPT
   {  return const_cast<T*>(static_cast<const T*>(static_cast<const void*>(&storage)));  }

   T* internal_storage() BOOST_CONTAINER_NOEXCEPT
   {  return static_cast<T*>(static_cast<void*>(&storage));  }

   static const std::size_t internal_capacity = N;

   typedef boost::container::container_detail::version_type<static_storage_allocator, 0>   version;

   friend bool operator==(const static_storage_allocator &, const static_storage_allocator &) BOOST_CONTAINER_NOEXCEPT
   {  return false;  }

   friend bool operator!=(const static_storage_allocator &, const static_storage_allocator &) BOOST_CONTAINER_NOEXCEPT
   {  return true;  }
예제 #2
0
template<class T, std::size_t N>
class static_storage_allocator
{
   public:
   typedef T value_type;

   static_storage_allocator() BOOST_NOEXCEPT_OR_NOTHROW
   {}

   static_storage_allocator(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
   {}

   static_storage_allocator & operator=(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
   {}

   T* internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW
   {  return const_cast<T*>(static_cast<const T*>(static_cast<const void*>(&storage)));  }

   T* internal_storage() BOOST_NOEXCEPT_OR_NOTHROW
   {  return static_cast<T*>(static_cast<void*>(&storage));  }

   static const std::size_t internal_capacity = N;

   typedef boost::container::container_detail::version_type<static_storage_allocator, 0>   version;

   friend bool operator==(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
   {  return false;  }

   friend bool operator!=(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
   {  return true;  }