Blaze 3.9
blaze::SubvectorTrait< VT, CSAs > Struct Template Reference

Base template for the SubvectorTrait class. More...

#include <SubvectorTrait.h>

Inherits decltype evalSubvectorTrait std::declval< VT & >.

Detailed Description

template<typename VT, size_t... CSAs>
struct blaze::SubvectorTrait< VT, CSAs >

Base template for the SubvectorTrait class.

General

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

template< typename T1, bool TF, size_t... CSAs >
struct SubvectorTrait< DynamicVector<T1,TF>, CSAs... >
{
using Type = DynamicVector<T1,TF>;
};


Examples

The following example demonstrates the use of the SubvectorTrait 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::SubvectorTrait<VectorType1>::Type;
// Definition of the result type for the inner two elements of a static row vector
Efficient implementation of an arbitrary sized vector.
Definition: DynamicVector.h:223
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
Base template for the SubvectorTrait class.
Definition: SubvectorTrait.h:126

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