calculated_value

Synopsis

template <class T, class ValueType, class Tag>
struct calculated_value
{
  // unspecified
};

Description

Defines a [tmp_value](tmp_value.html)<T, Tag> with a public static ::value element. It will be initialised using the expression T::get_value().

#include <mpllibs/metamonad/calculated_value.hpp>

Expression semantics

For any t, v and a types the following are equivalent:

calculated_value<t, v, a>::type
t
calculated_value<t, v, a>::tag
a

and the following is also provided:

static const v calculated_value<t, v, a>::value(t::get_value());

Example

struct nothing : calculated_value<nothing, std::string>
{
  static std::string get_value() { return "nothing"; }
};

[up]