Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Meta-programming

Meta-programming is the use of the C++ template system to implement compile-time behaviors. Template meta-programming consists in providing functions working on types and/or to produce values using types. It must be noted that the value provided by a type is named, in ELM, "_" instead of "value" used in STL. More...

Classes

struct  n< x >
 
struct  em
 
struct  _if< c, T, E >
 
struct  is_supported< T, C >
 
struct  enable_if< B, T >
 

Functions

template<class T >
T & declval ()
 

Detailed Description

Meta-programming is the use of the C++ template system to implement compile-time behaviors. Template meta-programming consists in providing functions working on types and/or to produce values using types. It must be noted that the value provided by a type is named, in ELM, "_" instead of "value" used in STL.

Included in the Meta-programming namespace, the following facilities are available:

Function Documentation

◆ declval()

T & declval ( )
inline

#include <include/elm/meta.h>

Function generating an abstract value of type T. The returned value is abstract means it does not correspond to any value in memory and therefore must not be used in classic code. A more consistent use of declval() is in meta-programming when a value is needed, for instance, to select a function by parameter overloading.

For example, the code below selects the return type of a function f() taking no parameter:

template <class T>
decltype(meta::declval<T>().f()) ff(T *v) { return v.f(); }
Parameters
TType of the returned abstract value.