Pair

◆ as_pair

template<class val >
using metal::as_pair = typedef metal::apply<metal::lambda<metal::pair>, metal::as_list<val> >

#include <metal/pair/pair.hpp>

Description

Constructs a Pair out of any Value that is a specialization of a template class or union that takes exactly two template parameters that are themselves Values.

Usage

For any Value val

using result = metal::as_pair<val>;
Returns
: Pair

Example

IS_SAME(metal::as_pair<std::pair<int, char>>, metal::list<int, char>);
IS_SAME(
metal::as_pair<std::unique_ptr<int>>,
metal::pair<int, std::default_delete<int>>
);

See Also

See also
pair

◆ first

template<class seq >
using metal::first = typedef metal::if_<metal::is_pair<seq>, metal::front<seq> >

#include <metal/pair/first.hpp>

Description

Retrieves the first element of a Pair.

Usage

For any Pair p

using result = metal::first<p>;
Returns
: Value
Semantics:
If p contains Values p_0 and p_1 in that order, then
using result = p_0;

Example

See Also

See also
pair, second

◆ is_pair

template<class val >
using metal::is_pair = typedef typename detail::_is_pair<val>::type

#include <metal/pair/pair.hpp>

Description

Checks whether some Value is a Pair.

Usage

For any Value val

using result = metal::is_pair<val>;
Returns
: Number
Semantics:
If val is a Pair, then
using result = metal::true_;
otherwise
using result = metal::false_;

Example

See Also

See also
pair, is_value, is_number, is_lambda, is_list, is_map

◆ pair

template<class x , class y >
using metal::pair = typedef metal::list<x, y>

#include <metal/pair/pair.hpp>

Description

Constructs a Pair out of a pair of Values.

Usage

For any pair of Values x and y

using result = metal::pair<x, y>;
Returns
: Pair

See Also

See also
is_pair

◆ second

template<class seq >
using metal::second = typedef metal::if_<metal::is_pair<seq>, metal::back<seq> >

#include <metal/pair/second.hpp>

Description

Retrieves the second element of a Pair.

Usage

For any Pair p

using result = metal::second<p>;
Returns
: Value
Semantics:
If p contains Values p_0 and p_1 in that order, then
using result = p_1;

Example

See Also

See also
pair, first