MDL SDK API nvidia_logo_transpbg.gif Up
mi::base::Std_allocator<T> Class Template Reference

An adaptor class template that implements a standard STL allocator. More...

#include <std_allocator.h>

Classes

struct  rebind
 Rebind helper struct to define a new class instance of this allocator template instantiated for the new value type T1. More...
 

Public Types

using value_type = T
 Value type allocated by this allocator. More...
 
using pointer = T *
 Pointer type. More...
 
using const_pointer = const T *
 Const pointer type. More...
 
using reference = T &
 Reference type. More...
 
using const_reference = const T &
 Const reference type. More...
 
using size_type = std::size_t
 Size type. More...
 
using difference_type = std::ptrdiff_t
 Difference type. More...
 

Public Member Functions

 Std_allocator () noexcept
 Default constructor. More...
 
 Std_allocator (base::IAllocator *allocator) noexcept
 Constructor. More...
 
template<class T1>
 Std_allocator (const Std_allocator<T1> &other) noexcept
 Copying constructor template for alike allocators of different value type. More...
 
pointer address (reference x) const
 Returns address of object x allocated through this allocator. More...
 
const_pointer address (const_reference x) const
 Returns const address of object x allocated through this allocator. More...
 
T * allocate (size_type n, const void *=nullptr) noexcept
 Allocate uninitialized dynamic memory for n elements of type T. More...
 
void deallocate (pointer p, size_type)
 Frees uninitialized dynamic memory at location p that has previously been allocated with allocate(). More...
 
size_type max_size () const noexcept
 Returns the maximum number of elements of type T that can be allocated using this allocator. More...
 
void construct (pointer p, const_reference value)
 Calls the copy constructor of T on the location p with the argument value. More...
 
void destroy (pointer p)
 Calls the destructor of T on the location p. More...
 
IAllocatorget_allocator () const
 Returns the interface of the underlying allocator. More...
 
template<class T2>
bool operator== (Std_allocator<T2> other) const noexcept
 Equality comparison. More...
 
template<class T2>
bool operator!= (Std_allocator<T2> other) const noexcept
 Inequality comparison. More...
 

Detailed Description

template<class T>
class mi::base::Std_allocator<T>

An adaptor class template that implements a standard STL allocator.

The implementation of the STL allocator is based on the mi::base::IAllocator interface.

Template Parameters
TThe value type of the allocator.
Include File:
#include <mi/base/std_allocator.h>