Recent Changes - Search:




(redirected from Main.Metafunctions)

  • interface (declared in interface.h)

This metafunction provides the interface (or Concept) that a given type follows, and a value_type.

template <typename T>
struct interface
   using type = ...;
   using value_type = ...;

The default implementation has a type of AnyScalar<T>, meaning it is a scalar type, and a value_type of T itself.

Vectors will have a type of some type from the vector concept hierarchy, and value_type will be the same as the vector value_type (ie, the type that the vector contains).

  • make_value_from_interface (declared in interface.h)

This metafunction is used to get a concrete type from a given type (typically, an expression). This may be used, for example, if a temporary is required during evaluation of an expression.

template <typename T, typename Ti = typename interface<T>::type>
struct make_value_from_interface
   using type = ''concrete_type'';
  • make_value<T>

Metafunction for getting a concrete type. Doesn't need customization. Strips references and const and returns make_value_from_interface.

  • value_type<T>::type

Alias for interface<T>::value_type

  • has_zero<T>

This metafunction is true if T has a zero value that can be constructed without any additional information. Typically, a scalar will have a zero value, but a matrix or vector will not (because the size information wouldn't be available).

  • function zero<T>()

If has_zero<T>, then returns the zero element of type T.

  • function is_zero(T x)

Only defined if has_zero<T>. Returns true if x is equal to the zero element.

Edit - History - Print - Recent Changes - Search
Page last modified on October 04, 2015, at 09:33 AM