siplasplas
A library for C++ reflection and introspection
cpp::Identity Class Reference

A functor class implementing the identity function. More...

#include <siplasplas/utility/identity.hpp>

Public Member Functions

template<typename T >
constexpr auto operator() (T &&value) -> decltype(std::forward< T >(value)) const
 
template<typename T , typename Function >
constexpr auto type (Function callback) -> decltype(callback(meta::identity< T >())) const
 
template<typename T >
constexpr auto type () const
 

Detailed Description

A functor class implementing the identity function.

The identity function takes a value of any type and returns it as is. The function performs no mutation of the value. Given an expression x decltype(x) == decltype(Identity()(x)) and the yield value is the same. This function is useful to delay the evaluation of an expression to the second template processing phase (The on instantiation phase). See cpp::staticIf or cpp::compiles.


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