1 #ifndef Protium_STLAdapter_h_
2 #define Protium_STLAdapter_h_
16 template<
typename Host,
typename AllocType = SmallObjectAllocator<> >
65 Host*
address(Host& elem)
const {
return &elem;}
68 const Host*
address(
const Host& elem)
const {
return &elem;}
71 Host*
allocate(std::size_t count,
const void* hint=0){
73 void* p = AllocType::Instance().Allocate(count*
sizeof(Host),
true );
74 return reinterpret_cast<Host*
>(p);
79 AllocType::Instance().Deallocate(p, size*
sizeof(Host));
84 const std::size_t max = std::size_t(-1);
85 const std::size_t bytes = max/
sizeof(Host);
102 template<
typename Host>
108 template <
typename Host >
117 #endif //File Guardian
const Host & const_reference
Const Reference to host type.
STLAdapter(const STLAdapter &)
Copy constructor utilizes nothing.
const Host & const_hostRef
bool operator!=(const STLAdapter< Host > &, const STLAdapter< Host > &)
Always returns false. Nothing internal.
const Host * const_hostPointer
const Host * const_pointer
Const Pointer to host type.
Host * address(Host &elem) const
Returns the address of the host object.
const Host * address(const Host &elem) const
Returns the const address of the host object.
void construct(Host *p, const Host &value)
Constructs a copy host instance at the pointer.
std::size_t max_size() const
Returns the maximum number of objects that can be allocated at once.
~STLAdapter()
Nothing to destruct.
Host & reference
Reference to host type.
Host value_type
Host Type.
STLAdapter(const STLAdapter< T > &)
Templated copy constructor does nothing.
STLAdapter()
Default constuctor does nothing.
bool operator==(const STLAdapter< Host > &, const STLAdapter< Host > &)
Always returns true. Nothing internal.
std::ptrdiff_t difference_type
Type to be used when calculating distance between pointers.
Host * pointer
Pointer type to host type.
Allocator to be used by STL containers.
Allows Adapters to use each other.
Host * allocate(std::size_t count, const void *hint=0)
Allocates out a host object type.
void deallocate(Host *p, std::size_t size)
Deallocates host objects up to size.
std::size_t size_type
Size to be used in allocation.
void destroy(Host *p)
Destructs the host instance at p.