123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- #ifndef BOOST_ASIO_RECYCLING_ALLOCATOR_HPP
- #define BOOST_ASIO_RECYCLING_ALLOCATOR_HPP
- #if defined(_MSC_VER) && (_MSC_VER >= 1200)
- # pragma once
- #endif
- #include <boost/asio/detail/config.hpp>
- #include <boost/asio/detail/recycling_allocator.hpp>
- #include <boost/asio/detail/push_options.hpp>
- namespace boost {
- namespace asio {
- template <typename T>
- class recycling_allocator
- {
- public:
-
- typedef T value_type;
-
- template <typename U>
- struct rebind
- {
-
- typedef recycling_allocator<U> other;
- };
-
- constexpr recycling_allocator() noexcept
- {
- }
-
- template <typename U>
- constexpr recycling_allocator(
- const recycling_allocator<U>&) noexcept
- {
- }
-
- constexpr bool operator==(
- const recycling_allocator&) const noexcept
- {
- return true;
- }
-
- constexpr bool operator!=(
- const recycling_allocator&) const noexcept
- {
- return false;
- }
-
- T* allocate(std::size_t n)
- {
- return detail::recycling_allocator<T>().allocate(n);
- }
-
- void deallocate(T* p, std::size_t n)
- {
- detail::recycling_allocator<T>().deallocate(p, n);
- }
- };
- template <>
- class recycling_allocator<void>
- {
- public:
-
- typedef void value_type;
-
- template <typename U>
- struct rebind
- {
-
- typedef recycling_allocator<U> other;
- };
-
- constexpr recycling_allocator() noexcept
- {
- }
-
- template <typename U>
- constexpr recycling_allocator(
- const recycling_allocator<U>&) noexcept
- {
- }
-
- constexpr bool operator==(
- const recycling_allocator&) const noexcept
- {
- return true;
- }
-
- constexpr bool operator!=(
- const recycling_allocator&) const noexcept
- {
- return false;
- }
- };
- }
- }
- #include <boost/asio/detail/pop_options.hpp>
- #endif
|