Value

◆ distinct

template<class... vals>
using metal::distinct = typedef typename detail::_distinct<vals...>::type

#include <metal/value/distinct.hpp>

Description

Checks whether no Values are identical.

Usage

For any Values val_0, ..., val_n-1

using result = metal::distinct<val_0, ..., val_n-1>;
Returns
: Number
Semantics:
If at least two Values in val_0, ..., val_n-1 are identical to each other, then
using result = metal::false_;
otherwise
using result = metal::true_;

Example

See Also

See also
same

◆ eval

template<class val >
using metal::eval = typedef typename val::type

#include <metal/value/eval.hpp>

Description

Evaluates lazy constructs by retrieving their nested typename type.

Usage

For any Value val

using result = metal::eval<val>;
Returns
: Value
Semantics:
Equivalent to
using result = typename val::type;

Example

IS_SAME(metal::eval<std::add_pointer<void>>, void*);

See Also

See also
value, lazy, id

◆ fold_left

template<class lbd , class... vals>
using metal::fold_left = typedef detail::call<detail::_fold_left<lbd>::template type, vals...>

#include <metal/value/fold_left.hpp>

Description

Computes the recursive invocation of a binary Lambda with the result of the previous invocation and each Value, from the first to the last.

Usage

For any Lambda lbd, and Values val_0, ..., val_n-1

using result = metal::fold_left<lbd, val_0, ..., val_n-1>;
Returns
: Value
Semantics:
Equivalent to
using result =
lbd(... lbd(lbd(val_0, val_1), val_2), ..., val_n-1)
where lbd(x, y) stands for metal::invoke<lbd, x, y>.

Example

template<class x, class y>
struct f {};
using lbd = metal::lambda<f>;
IS_SAME(
f<f<f<f<f<short, int>, long>, float>, double>, void>
);

See Also

See also
fold_right

◆ fold_right

template<class lbd , class... vals>
using metal::fold_right = typedef detail::call<detail::_fold_right<lbd>::template type, vals...>

#include <metal/value/fold_right.hpp>

Description

Computes the recursive invocation of a binary Lambda with the result of the previous invocation and each Value, from the last to the first.

Usage

For any Lambda lbd, and Values val_0, ..., val_n-1

using result = metal::fold_right<lbd, val_0, ..., val_n-1>;
Returns
: Value
Semantics:
Equivalent to
using result =
lbd(val_0, ..., lbd(val_n-3, lbd(val_n-2, val_n-1)), ...)
where lbd(x, y) stands for metal::invoke<lbd, x, y>.

Example

template<class x, class y>
struct f {};
using lbd = metal::lambda<f>;
IS_SAME(
f<short, f<int, f<long, f<float, f<double, void>>>>>
);

See Also

See also
fold_right

◆ identity

template<class val >
using metal::identity = typedef val

#include <metal/value/identity.hpp>

Description

The identity Expression.

Usage

For any Value val

using result = metal::identity<val>;
Returns
: Value
Semantics:
Equivalent to
using result = val;

Example

See Also

See also
value, eval

◆ is_value

template<class val >
using metal::is_value = typedef metal::true_

#include <metal/value/value.hpp>

Description

A tautological predicate that checks whether some type is a Value.

Tip
Use metal::is_value to trigger SFINAE.

Usage

For any Value val

using result = metal::is_value<val>;
Returns
: Number
Semantics:
Equivalent to
using result = metal::true_;

Example

template<class T, class = metal::true_>
struct has_type_impl :
{};
template<class T>
struct has_type_impl<T, metal::is_value<typename T::type>> :
{};
template<class T>
using has_type = typename has_type_impl<T>::type;
IS_SAME(has_type<metal::value<void>>, metal::true_);
IS_SAME(has_type<metal::value<>>, metal::false_);

See Also

See also
value, nil, is_number, is_lambda, is_pair, is_list, is_map

◆ nil

using metal::nil = typedef metal::value<>

#include <metal/value/value.hpp>

Description

An empty metal::value.

Usage

using result = metal::nil;
Returns
: Value
Semantics:
Equivalent to
using result = {};

See Also

See also
is_value, value

◆ same

template<class... vals>
using metal::same = typedef typename detail::_same<vals...>::type

#include <metal/value/same.hpp>

Description

Checks whether all Values are identical.

Usage

For any Values val_0, ..., val_n-1

using result = metal::same<val_0, ..., val_n-1>;
Returns
: Number
Semantics:
If at least two Values in val_0, ..., val_n-1 are not identical to each other, then
using result = metal::false_;
otherwise
using result = metal::true_;

Example

See Also

See also
distinct

◆ value

template<class val = detail::na>
using metal::value = typedef { using type = val

#include <metal/value/value.hpp>

Description

Constructs a Value that is guaranteed not to be a Number, or a Lambda or a List, out of any other Value.

The original Value may be retrieved back by naming the nested typename type, unless metal::value is empty, in which case type is undefined.

Tip
Use metal::value to prevent undesired template pattern matching.

Usage

For any Value val

using result = metal::value<val>;
Returns
: Value
Semantics:
Equivalent to
using result = { using type = val; };

Example

See Also

See also
is_value, nil