2
0
mirror of https://github.com/boostorg/hana.git synced 2026-02-01 08:32:11 +00:00
Files
hana/example/product.cpp
Louis Dionne dab93cc263 [Comparable] Update docs, split methods and more
- Use == for cross-type EqualityComparable data types
- Remove the not_equal mcd
2015-02-10 19:18:40 -05:00

47 lines
872 B
C++

/*
@copyright Louis Dionne 2014
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#include <boost/hana/assert.hpp>
#include <boost/hana/pair.hpp>
#include <string>
using namespace boost::hana;
using namespace std::literals;
int main() {
{
//! [comparable]
BOOST_HANA_RUNTIME_CHECK(pair(1, "234"s) == pair(1ll, "234"s));
BOOST_HANA_CONSTEXPR_CHECK(pair('x', 2) != pair('y', 2));
//! [comparable]
}{
//! [first]
BOOST_HANA_CONSTEXPR_CHECK(first(pair(1, 'x')) == 1);
//! [first]
}{
//! [second]
BOOST_HANA_CONSTEXPR_CHECK(second(pair(1, 'x')) == 'x');
//! [second]
}{
//! [make]
BOOST_HANA_CONSTEXPR_CHECK(make<Pair>(1, 'x') == pair(1, 'x'));
BOOST_HANA_CONSTEXPR_CHECK(first(pair(1, 'x')) == 1);
BOOST_HANA_CONSTEXPR_CHECK(second(pair(1, 'x')) == 'x');
//! [make]
}
}