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

Base template for the SubvectorTrait class. More...

#include <SubvectorTrait.h>

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. SubvectorTrait defines the nested type Type, which represents the resulting data type of the subvector operation. In case the given data type is not a dense or sparse vector 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, 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

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