Blaze  3.6
blaze::ExpandTrait< T, CEAs > Struct Template Reference

Base template for the ExpandTrait class. More...

#include <ExpandTrait.h>

Detailed Description

template<typename T, size_t... CEAs>
struct blaze::ExpandTrait< T, CEAs >

Base template for the ExpandTrait class.

General

The ExpandTrait class template offers the possibility to select the resulting data type when expanding a dense or sparse vector or matrix. ExpandTrait defines the nested type Type, which represents the resulting data type of the expand operation. In case the given data type is not a dense or sparse vector or matrix type, the resulting data type Type is set to INVALID_TYPE. Note that const and volatile qualifiers and reference modifiers are generally ignored.

Creating custom specializations

Per default, ExpandTrait supports all vector and matrix types of the Blaze library (including views and adaptors). For all other data types it is possible to specialize the ExpandTrait template. The following example shows the according specialization for the DynamicVector class template:

template< typename Type, bool TF, size_t... CEAs >
struct ExpandTrait< DynamicVector<Type,TF>, CEAs... >
{
using Type = DynamicMatrix<Type,( TF == columnVector ? columnMajor : rowMajor )>;
};


Examples

The following example demonstrates the use of the ExpandTrait template, where depending on the given vector or matrix type the resulting type is selected:

// Definition of the resulting type of a dynamic column vector
using ResultType1 = typename blaze::ExpandTrait<VectorType1>::Type;
// Definition of the resulting type of a static row vector
using ResultType2 = typename blaze::ExpandTrait<VectorType2>::Type;

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