![]() |
Base template for the SubTrait class. More...
#include <SubTrait.h>
Base template for the SubTrait class.
The SubTrait class template offers the possibility to select the resulting data type of a generic subtraction operation between the two given types T1 and T2. SubTrait defines the nested type Type, which represents the resulting data type of the subtraction. In case the two types T1 and T2 cannot be subtracted, a compilation error is created. Note that const
and volatile
qualifiers and reference modifiers are generally ignored.
SubTrait is guaranteed to work for all built-in data types, complex numbers, all vector and matrix types of the Blaze library (including views and adaptors) and all data types that provide a subtraction operator (i.e. operator-
). In order to add support for user-defined data types that either don't provide a subtraction operator or whose subtraction operator returns a proxy object instead of a concrete type (as it is for instance common in expression template libraries) it is possible to specialize the SubTrait template. The following example shows the according specialization for the subtraction between two dynamic column vectors:
The following example demonstrates the use of the SubTrait template, where depending on the two given data types the resulting data type is selected: