2
0
mirror of https://github.com/boostorg/hana.git synced 2026-02-01 08:32:11 +00:00

[Map] Add make<Map> and remove map(...)

This commit is contained in:
Louis Dionne
2015-03-07 21:25:12 -05:00
parent bd4daea264
commit 8a73a3208e
7 changed files with 156 additions and 93 deletions

View File

@@ -14,21 +14,49 @@ Distributed under the Boost Software License, Version 1.0.
#include <string>
using namespace boost::hana;
using namespace std::literals;
int main() {
{
//! [comparable]
//! [make<Map>]
using namespace std::literals;
auto m = make<Map>(
make<Pair>(int_<1>, "foobar"s),
make<Pair>(type<void>, 1234)
);
//! [make<Map>]
(void)m;
}{
//! [make_map]
using namespace std::literals;
BOOST_HANA_RUNTIME_CHECK(
map(
make_map(
make<Pair>(int_<1>, "foobar"s),
make<Pair>(type<void>, 1234)
)
==
make<Map>(
make<Pair>(int_<1>, "foobar"s),
make<Pair>(type<void>, 1234)
)
);
//! [make_map]
}{
//! [comparable]
using namespace std::literals;
BOOST_HANA_RUNTIME_CHECK(
make_map(
pair(char_<'a'>, "foobar"s),
pair(type<int&&>, nullptr)
)
==
map(
make_map(
pair(type<int&&>, (void*)0),
pair(char_<'a'>, "foobar"s)
)
@@ -38,7 +66,7 @@ BOOST_HANA_RUNTIME_CHECK(
}{
//! [searchable]
BOOST_HANA_CONSTEXPR_LAMBDA auto m = map(
BOOST_HANA_CONSTEXPR_LAMBDA auto m = make_map(
pair(type<int>, 'i'),
pair(type<float>, 'f')
);