Blaze 3.9
blaze::DynamicAllocator< A1, As > Struct Template Reference

Deduction of an allocator type for dynamic vectors and matrices. More...

#include <DynamicAllocator.h>

Detailed Description

template<typename A1, typename... As>
struct blaze::DynamicAllocator< A1, As >

Deduction of an allocator type for dynamic vectors and matrices.

General

The DynamicAllocator type trait deduces the allocator type for dynamic vectors and matrices. Given one or two allocators, it provides a nested Type alias template, which results in the according allocator type:

using A1 = AlignedAllocator<int>;
using A2 = AlignedAllocator<double>;
blaze::DynamicAllocator<A1,A2>::Type<double> // Results in 'AlignedAllocator<double>'
Deduction of an allocator type for dynamic vectors and matrices.
Definition: DynamicAllocator.h:95

In case no resulting allocator type can be determined, the nested Type template will result in blaze::NullAllocator for all possible types.


Creating custom specializations

DynamicAllocator is guaranteed to work only for all Blaze allocator types. In order to add support for user-defined allocator types it is possible to specialize the DynamicAllocator template. The following example demonstrates the according specialization for the blaze::AlignedAllocator class template:

template< typename T1, typename T2 >
struct DynamicAllocator< AlignedAllocator<T1>, AlignedAllocator<T2> >
{
template< typename U >
using Type = AlignedAllocator<U>;
};

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