Blaze 3.9
blaze::ColumnsTrait< MT, N > Struct Template Reference

Base template for the ColumnsTrait class. More...

#include <ColumnsTrait.h>

Inherits decltype evalColumnsTrait std::declval< MT & >.

Detailed Description

template<typename MT, size_t N>
struct blaze::ColumnsTrait< MT, N >

Base template for the ColumnsTrait class.

General

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

template< typename T1, bool SO, size_t N >
struct ColumnsTrait< DynamicMatrix<T1,SO>, N >
{
using Type = DynamicMatrix<T1,true>;
};


Examples

The following example demonstrates the use of the ColumnsTrait template, where depending on the given matrix type the resulting columns type is selected:

// Definition of the columns type of a column-major dynamic matrix
using ResultType1 = typename blaze::ColumnsTrait<MatrixType1,0UL>::Type;
// Definition of the columns type for two columns of a row-major static matrix
using ResultType2 = typename blaze::ColumnsTrait<MatrixType2,2UL>::Type;
Efficient implementation of a dynamic matrix.
Definition: DynamicMatrix.h:242
Efficient implementation of a fixed-sized matrix.
Definition: StaticMatrix.h:249
constexpr bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
constexpr bool columnMajor
Storage order flag for column-major matrices.
Definition: StorageOrder.h:99
Base template for the ColumnsTrait class.
Definition: ColumnsTrait.h:121

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