Zserio C++17 runtime library  0.5.0
Built for Zserio 2.17.0
zserio::ppmr::PropagatingPolymorphicAllocator< T > Class Template Reference

#include <PropagatingPolymorphicAllocator.h>

Public Types

using value_type = T
 
using propagate_on_container_copy_assignment = std::true_type
 
using propagate_on_container_move_assignment = std::true_type
 
using propagate_on_container_swap = std::true_type
 

Public Member Functions

 PropagatingPolymorphicAllocator (std::pmr::memory_resource *resource=std::pmr::get_default_resource()) noexcept
 
template<class U >
 PropagatingPolymorphicAllocator (const PropagatingPolymorphicAllocator< U > &other) noexcept
 
template<class U >
PropagatingPolymorphicAllocatoroperator= (const PropagatingPolymorphicAllocator< U > &other) noexcept
 
value_typeallocate (std::size_t size)
 
void deallocate (value_type *memory, std::size_t size) noexcept
 
template<typename U , typename... Args>
void construct (U *ptr, Args &&... args)
 
template<typename U >
void destroy (U *ptr) noexcept(noexcept(ptr->~U()))
 
PropagatingPolymorphicAllocator select_on_container_copy_construction () const
 
std::pmr::memory_resource * resource () const noexcept
 
 ~PropagatingPolymorphicAllocator ()=default
 
 PropagatingPolymorphicAllocator (const PropagatingPolymorphicAllocator &other) noexcept=default
 
PropagatingPolymorphicAllocatoroperator= (const PropagatingPolymorphicAllocator &other) noexcept=default
 
 PropagatingPolymorphicAllocator (PropagatingPolymorphicAllocator &&other) noexcept=default
 
PropagatingPolymorphicAllocatoroperator= (PropagatingPolymorphicAllocator &&other) noexcept=default
 

Detailed Description

template<class T>
class zserio::ppmr::PropagatingPolymorphicAllocator< T >

Propagating version of the polymorphic allocator. This one is propagated on container copy and assignment.

Definition at line 16 of file PropagatingPolymorphicAllocator.h.

Member Typedef Documentation

◆ propagate_on_container_copy_assignment

Definition at line 21 of file PropagatingPolymorphicAllocator.h.

◆ propagate_on_container_move_assignment

Definition at line 22 of file PropagatingPolymorphicAllocator.h.

◆ propagate_on_container_swap

template<class T >
using zserio::ppmr::PropagatingPolymorphicAllocator< T >::propagate_on_container_swap = std::true_type

Definition at line 23 of file PropagatingPolymorphicAllocator.h.

◆ value_type

template<class T >
using zserio::ppmr::PropagatingPolymorphicAllocator< T >::value_type = T

Definition at line 19 of file PropagatingPolymorphicAllocator.h.

Constructor & Destructor Documentation

◆ PropagatingPolymorphicAllocator() [1/4]

template<class T >
zserio::ppmr::PropagatingPolymorphicAllocator< T >::PropagatingPolymorphicAllocator ( std::pmr::memory_resource *  resource = std::pmr::get_default_resource())
inlinenoexcept

Constructor.

Note that this is intentionally non-explicit to allow to pass MemoryResource wherever the PropagatingPolymorphicAllocator is required.

Parameters
resourceMemory resource. According to the C++ standard the resource may not be NULL. Since it implies undefined behaviour, we define a non-standard extension here. When the resource is NULL, std::pmr::get_default_resource() is used instead!

Definition at line 35 of file PropagatingPolymorphicAllocator.h.

◆ ~PropagatingPolymorphicAllocator()

Method generated by default.

◆ PropagatingPolymorphicAllocator() [2/4]

Method generated by default.

◆ PropagatingPolymorphicAllocator() [3/4]

Method generated by default.

◆ PropagatingPolymorphicAllocator() [4/4]

template<class T >
template<class U >
zserio::ppmr::PropagatingPolymorphicAllocator< T >::PropagatingPolymorphicAllocator ( const PropagatingPolymorphicAllocator< U > &  other)
inlinenoexcept

Copy constructor from PropagatingPolymorphicAllocator with another value_type.

Parameters
otherOther PropagatingPolymorphicAllocator.

Definition at line 62 of file PropagatingPolymorphicAllocator.h.

Member Function Documentation

◆ allocate()

template<class T >
value_type* zserio::ppmr::PropagatingPolymorphicAllocator< T >::allocate ( std::size_t  size)
inline

Allocates memory for n values.

Parameters
sizeNumber of values to allocate memory for.

Definition at line 82 of file PropagatingPolymorphicAllocator.h.

◆ construct()

template<class T >
template<typename U , typename... Args>
void zserio::ppmr::PropagatingPolymorphicAllocator< T >::construct ( U *  ptr,
Args &&...  args 
)
inline

Constructs an object in allocated memory.

Parameters
ptrPointer to memory where the object will be constructed.
argsParameters to be forwarded to the object constructor.

Definition at line 106 of file PropagatingPolymorphicAllocator.h.

◆ deallocate()

template<class T >
void zserio::ppmr::PropagatingPolymorphicAllocator< T >::deallocate ( value_type memory,
std::size_t  size 
)
inlinenoexcept

Deallocates memory for n values.

Parameters
memoryPointer to the memory to deallocate.
sizeNumber of values held by the memory pointed to by memory. Shall be the same size as was used for allocation of memory.

Definition at line 94 of file PropagatingPolymorphicAllocator.h.

◆ destroy()

template<class T >
template<typename U >
void zserio::ppmr::PropagatingPolymorphicAllocator< T >::destroy ( U *  ptr)
inlinenoexcept

Destroys an object

Parameters
ptrPointer to the object to be destroyed.

Definition at line 132 of file PropagatingPolymorphicAllocator.h.

◆ operator=() [1/3]

template<class T >
PropagatingPolymorphicAllocator& zserio::ppmr::PropagatingPolymorphicAllocator< T >::operator= ( const PropagatingPolymorphicAllocator< T > &  other)
defaultnoexcept

Method generated by default.

◆ operator=() [2/3]

template<class T >
template<class U >
PropagatingPolymorphicAllocator& zserio::ppmr::PropagatingPolymorphicAllocator< T >::operator= ( const PropagatingPolymorphicAllocator< U > &  other)
inlinenoexcept

Assignment operator from PropagatingPolymorphicAllocator with another value_type.

Parameters
otherOther PropagatingPolymorphicAllocator.

Definition at line 72 of file PropagatingPolymorphicAllocator.h.

◆ operator=() [3/3]

template<class T >
PropagatingPolymorphicAllocator& zserio::ppmr::PropagatingPolymorphicAllocator< T >::operator= ( PropagatingPolymorphicAllocator< T > &&  other)
defaultnoexcept

Method generated by default.

◆ resource()

template<class T >
std::pmr::memory_resource* zserio::ppmr::PropagatingPolymorphicAllocator< T >::resource ( ) const
inlinenoexcept

Gets the underlying memory resource.

Definition at line 148 of file PropagatingPolymorphicAllocator.h.

◆ select_on_container_copy_construction()

template<class T >
PropagatingPolymorphicAllocator zserio::ppmr::PropagatingPolymorphicAllocator< T >::select_on_container_copy_construction ( ) const
inline

Returns instance of the allocator to be used when a container gets copied.

Definition at line 140 of file PropagatingPolymorphicAllocator.h.


The documentation for this class was generated from the following file: