TooN 2.0.0-beta8
Static Public Attributes
IsField< C > Struct Template Reference

Is a number a field? ie, +, -, *, / defined. More...

#include <TooN.h>

List of all members.

Static Public Attributes

static const int value = numeric_limits<C>::is_specialized

Detailed Description

template<class C>
struct TooN::IsField< C >

Is a number a field? ie, +, -, *, / defined.

Specialize this to make TooN work properly with new types. The primary reason for this is to allow SFINAE to work properly. This is required if there are the following two functions:

          Vector<> * X  //Generic type X
          Vector<> * DiagonalMatrix<>

If one of the functions is a substitution failure, then it will be ignored, allowing the functions to coexist happily. However, not all types of failure are substitution failures. TooN's type deduction happens when determining the return type of the function. This is too early, so the wrong kind of error in the return type deduction causes an error, rather than a substitution failure. The IsField mechanism makes it the right kind of error, thereby allowing a substitution failuer to occur.