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 Valuesp_0
andp_1
in that order, thenusing result = p_0;
Example
See Also
◆ 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, thenotherwiseusing result = metal::true_;using result = metal::false_;
Example
IS_SAME(metal::is_pair<std::pair<int, unsigned>>, metal::false_);
See Also
◆ pair
template<class x , class y >
using metal::pair = typedef metal::list<x, y> |
◆ 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 Valuesp_0
andp_1
in that order, thenusing result = p_1;