#include "Stroika/Foundation/StroikaPreComp.h"
#include "Stroika/Foundation/Common/Empty.h"
#include "Stroika/Foundation/Memory/BlockAllocator.h"
#include "BlockAllocated.inl"
Go to the source code of this file.
Classes | |
struct | Stroika::Foundation::Memory::BlockAllocationUseHelper< T > |
struct | Stroika::Foundation::Memory::BlockAllocationUseGlobalAllocatorHelper< T > |
struct | Stroika::Foundation::Memory::InheritAndUseBlockAllocationIfAppropriate< DERIVED, BASE_REP, andTrueCheck > |
class | Stroika::Foundation::Memory::ManuallyBlockAllocated< T > |
ManuallyBlockAllocated<T> is a simple wrapper on BlockAllocator<T>. If qStroika_Foundation_Memory_PreferBlockAllocation defined, this will use block allocation for a given type - at a given call. More... | |
Namespaces | |
namespace | Stroika::Foundation |
Macros | |
#define | qStroika_Foundation_Memory_PreferBlockAllocation 1 |
Allow use of block-allocation in classes which uses DECLARE_USE_BLOCK_ALLOCATION(), or UseBlockAllocationIfAppropriate etc. | |
Typedefs | |
template<typename T , bool andTrueCheck = true> | |
using | Stroika::Foundation::Memory::UseBlockAllocationIfAppropriate = conditional_t< qStroika_Foundation_Memory_PreferBlockAllocation and andTrueCheck, BlockAllocationUseHelper< T >, Common::Empty > |
Use this to enable block allocation for a particular class. Beware of subclassing. | |
template<typename T , bool andTrueCheck = true> | |
using | Stroika::Foundation::Memory::BlockAllocatorOrStdAllocatorAsAppropriate = conditional_t< qStroika_Foundation_Memory_PreferBlockAllocation and andTrueCheck, BlockAllocator< T >, std::allocator< T > > |
for type T, either use BlockAllocator<T>, or std::allocator | |
Functions | |
template<typename T , typename... ARGS_TYPE> | |
auto | Stroika::Foundation::Memory::MakeSharedPtr (ARGS_TYPE &&... args) -> shared_ptr< T > |
same as make_shared, but if type T has block allocation, then use block allocation for the 'shared part' of T as well. | |
The reason for this option is for better use in templates like LinkedList<> - where we might want to blockallocate for small sizes of T, but not for ALL.
Definition in file BlockAllocated.h.
#define qStroika_Foundation_Memory_PreferBlockAllocation 1 |
Allow use of block-allocation in classes which uses DECLARE_USE_BLOCK_ALLOCATION(), or UseBlockAllocationIfAppropriate etc.
Allow use of block-allocation. The main reason to disable it indiscriminately is for debugging purposes (looking for memory leaks). But others may have other reasons.
Defaults to 1
Definition at line 40 of file BlockAllocated.h.
using Stroika::Foundation::Memory::UseBlockAllocationIfAppropriate = typedef conditional_t<qStroika_Foundation_Memory_PreferBlockAllocation and andTrueCheck, BlockAllocationUseHelper<T>, Common::Empty> |
Use this to enable block allocation for a particular class. Beware of subclassing.
This utility class can be used to avoid some of the C++ gorp required in declaring that you are using block-allocation with a given class.
If qStroika_Foundation_Memory_PreferBlockAllocation true (default) - this will use the optimized block allocation store, but if qStroika_Foundation_Memory_PreferBlockAllocation is false (0), this will just default to the global ::new/::delete
Definition at line 130 of file BlockAllocated.h.
using Stroika::Foundation::Memory::BlockAllocatorOrStdAllocatorAsAppropriate = typedef conditional_t<qStroika_Foundation_Memory_PreferBlockAllocation and andTrueCheck, BlockAllocator<T>, std::allocator<T> > |
for type T, either use BlockAllocator<T>, or std::allocator
Definition at line 198 of file BlockAllocated.h.
auto Stroika::Foundation::Memory::MakeSharedPtr | ( | ARGS_TYPE &&... | args | ) | -> shared_ptr<T> |
same as make_shared, but if type T has block allocation, then use block allocation for the 'shared part' of T as well.
Definition at line 52 of file BlockAllocated.inl.