All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
blaze::SubvectorTrait< VT > Struct Template Reference

Base template for the SubvectorTrait class. More...

#include <SubvectorTrait.h>

Detailed Description

template<typename VT>
struct blaze::SubvectorTrait< VT >

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.

Per default, the SubvectorTrait template only supports the following vector types:

Creating custom specializations

It is possible to specialize the SubvectorTrait template for additional user-defined vector types. The following example shows the according specialization for the DynamicVector class template:

template< typename T1, bool TF >
struct SubvectorTrait< DynamicVector<T1,TF> >
{
typedef DynamicVector<T1,TF> Type;
};


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
typedef typename SubvectorTrait<VectorType1>::Type ResultType1;
// Definition of the result type of the static row vector
typedef typename SubvectorTrait<VectorType2>::Type ResultType2;

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