Raven Engine v0.1
Loading...
Searching...
No Matches
Raven::ScopeWithAllocator< T > Class Template Reference

Scoped smart pointer that uses a specific allocator. More...

#include <Scope.h>

Public Member Functions

template<typename Allocator, typename... Args>
 ScopeWithAllocator (Allocator *allocator, Args &&... args)
 Constructs and allocates with given allocator.
 ScopeWithAllocator (ScopeWithAllocator &&other) noexcept
ScopeWithAllocatoroperator= (ScopeWithAllocator &&other) noexcept
 ~ScopeWithAllocator ()
 Destructor. Calls destructor and deallocates via allocator.
T * Get () const noexcept
 Gets the managed pointer.
T & operator* () const
T * operator-> () const noexcept

Detailed Description

template<typename T>
class Raven::ScopeWithAllocator< T >

Scoped smart pointer that uses a specific allocator.

Allocates object storage via either StackAllocator or MalevolentAllocator and calls the constructor via placement new. Deallocates appropriately on destruction.

Template Parameters
TThe type of object to manage.

Constructor & Destructor Documentation

◆ ScopeWithAllocator() [1/2]

template<typename T>
template<typename Allocator, typename... Args>
Raven::ScopeWithAllocator< T >::ScopeWithAllocator ( Allocator * allocator,
Args &&... args )
inlineexplicit

Constructs and allocates with given allocator.

Template Parameters
AllocatorType of allocator (StackAllocator<T> or MalevolentAllocator).
Parameters
allocatorPointer to allocator.
argsConstructor arguments for T.

◆ ScopeWithAllocator() [2/2]

template<typename T>
Raven::ScopeWithAllocator< T >::ScopeWithAllocator ( ScopeWithAllocator< T > && other)
inlinenoexcept

◆ ~ScopeWithAllocator()

template<typename T>
Raven::ScopeWithAllocator< T >::~ScopeWithAllocator ( )
inline

Destructor. Calls destructor and deallocates via allocator.

Member Function Documentation

◆ Get()

template<typename T>
T * Raven::ScopeWithAllocator< T >::Get ( ) const
inlinenoexcept

Gets the managed pointer.

Returns
The raw pointer.

◆ operator*()

template<typename T>
T & Raven::ScopeWithAllocator< T >::operator* ( ) const
inline

◆ operator->()

template<typename T>
T * Raven::ScopeWithAllocator< T >::operator-> ( ) const
inlinenoexcept

◆ operator=()

template<typename T>
ScopeWithAllocator & Raven::ScopeWithAllocator< T >::operator= ( ScopeWithAllocator< T > && other)
inlinenoexcept

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