5 // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
14 #include <boost/aligned_storage.hpp>
16 // Represents a single connection from a client.
25 void* allocate(std::size_t n)
27 if (in_use_ || n >= 1024)
28 return ::operator new(n);
30 return static_cast<void*>(&space_);
33 void deallocate(void* p)
35 if (p != static_cast<void*>(&space_))
42 allocator(const allocator&);
43 allocator& operator=(const allocator&);
45 // Whether the reusable memory space is currently in use.
48 // The reusable memory space made available by the allocator.
49 boost::aligned_storage<1024>::type space_;
52 #endif // ALLOCATOR_HPP