Blaze 3.9
Loading...
Searching...
No Matches
blaze::ElementsTrait< VT, N > Struct Template Reference

Base template for the ElementsTrait class. More...

#include <ElementsTrait.h>

Detailed Description

template<typename VT, size_t N>
struct blaze::ElementsTrait< VT, N >

Base template for the ElementsTrait class.

General

The ElementsTrait class template offers the possibility to select the resulting data type when selecting elements from a dense or sparse vector. In case the given type VT is a dense or sparse vector type, ElementsTrait defines the nested type Type, which represents the resulting data type of the elements 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, ElementsTrait supports all vector types of the Blaze library (including views and adaptors). For all other data types it is possible to specialize the ElementsTrait template. The following example shows the according specialization for the DynamicVector class template:

template< typename T1, bool TF, size_t N >
struct ElementsTrait< DynamicVector<T1,TF>, N >
{
};
Efficient implementation of an arbitrary sized vector.
Definition DynamicVector.h:223
Base template for the ElementsTrait class.
Definition ElementsTrait.h:121


Examples

The following example demonstrates the use of the ElementsTrait template, where depending on the given vector type the according result type is selected:

// Definition of the result type of a dynamic column vector
using ResultType1 = typename blaze::ElementsTrait<VectorType1,0UL>::Type;
// Definition of the result type for two elements of a static row vector
using ResultType2 = typename blaze::ElementsTrait<VectorType2,2UL>::Type;
Efficient implementation of a fixed-sized vector.
Definition StaticVector.h:230
constexpr bool columnVector
Transpose flag for column vectors.
Definition TransposeFlag.h:58
constexpr bool rowVector
Transpose flag for row vectors.
Definition TransposeFlag.h:73

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