Blaze 3.9
blaze::DeclZeroTrait< T > Struct Template Reference

Base template for the DeclZeroTrait class. More...

#include <DeclZeroTrait.h>

Inherits decltype evalDeclZeroTrait std::declval< T & >.

Detailed Description

template<typename T>
struct blaze::DeclZeroTrait< T >

Base template for the DeclZeroTrait class.

General

The DeclZeroTrait class template offers the possibility to select the resulting data type of a generic declzero() operation on the given type T. In case the given type T is a fitting data type, DeclZeroTrait defines the nested type Type, which represents the resulting data type of the declzero() operation. Otherwise there is no nested type Type. Note that const and volatile qualifiers and reference modifiers are generally ignored.

Creating custom specializations

Per default, DeclZeroTrait 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 DeclZeroTrait template. The following example shows the according specialization for the SymmetricMatrix class template:

template< typename MT, bool SO, bool DF, bool SF >
struct DeclZeroTrait< SymmetricMatrix<MT,SO,DF,SF> >
{
using Type = ZeroMatrix< ElementType_t<MT>, SO >;
};


Examples

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

// Definition of the resulting type of a row-major dynamic matrix
using VectorType = DynamicVector<int,rowVector>;
using DeclZeroType1 = typename DeclZeroTrait<VectorType>::Type;
// Definition of the resulting type of a symmetric column-major static matrix
using MatrixType = SymmetricMatrix< StaticMatrix<int,3UL,3UL,columnMajor> >;
using DeclZeroType2 = typename DeclZeroTrait<MatrixType>::Type;
Efficient implementation of an arbitrary sized vector.
Definition: DynamicVector.h:223
Efficient implementation of a fixed-sized matrix.
Definition: StaticMatrix.h:249
Matrix adapter for symmetric matrices.
Definition: BaseTemplate.h:614
constexpr bool columnMajor
Storage order flag for column-major matrices.
Definition: StorageOrder.h:99
constexpr bool rowVector
Transpose flag for row vectors.
Definition: TransposeFlag.h:73
Base template for the DeclZeroTrait class.
Definition: DeclZeroTrait.h:130

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