Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hana Experimental Types Sequence
#include<boost/hana.hpp>
#include<boost/hana/experimental/types.hpp>
namespace hana = boost::hana;
namespace hanax = boost::hana::experimental;
int main() {
{
constexpr auto xs = hanax::types<
hana::int_<1>,
hana::int_<2>,
hana::int_<3>
>{};
BOOST_HANA_CONSTANT_ASSERT(
hana::equal(xs, hanax::make_types(
hana::int_c<1>,
hana::int_c<2>,
hana::int_c<3>
))
);
BOOST_HANA_CONSTANT_ASSERT(
hana::equal(xs, hanax::make_types(
hana::type_c<hana::int_<1>>,
hana::type_c<hana::int_<2>>,
hana::type_c<hana::int_<3>>
))
);
BOOST_HANA_CONSTANT_ASSERT(
hana::equal(
hanax::make_types(xs, xs, xs),
hanax::make_types(
hanax::make_types(
hana::type_c<hana::int_<1>>,
hana::type_c<hana::int_<2>>,
hana::type_c<hana::int_<3>>
),
hanax::make_types(
hana::int_c<1>,
hana::int_c<2>,
hana::int_c<3>
),
hanax::make_types(
hana::int_c<1>,
hana::int_c<2>,
hana::int_c<3>
)
)
)
);
}
{
constexpr auto xs = hanax::types<
hana::int_<1>,
hana::int_<2>,
hana::int_<3>
>{};
BOOST_HANA_CONSTANT_ASSERT(
hana::equal(xs,
hana::prepend(
hanax::types<
hana::int_<2>,
hana::int_<3>
>{},
hana::int_c<1>
)
)
);
BOOST_HANA_CONSTANT_ASSERT(
hana::equal(xs,
hana::append(
hanax::types<
hana::int_<1>,
hana::int_<2>
>{},
hana::int_c<3>
)
)
);
BOOST_HANA_CONSTANT_ASSERT(
hana::equal(xs,
hana::concat(
hanax::types<
hana::int_<1>,
hana::int_<2>
>{},
hanax::types<
hana::int_<3>
>{}
)
)
);
}
{
constexpr auto xs = hanax::types<
hana::int_<0>,
hana::int_<1>,
hana::int_<2>,
hana::int_<3>,
hana::int_<4>,
hana::int_<5>,
hana::int_<6>,
hana::int_<7>,
hana::int_<8>
>{};
BOOST_HANA_CONSTANT_ASSERT(
hana::equal(xs,
hana::flatten(
hanax::make_types(
hanax::make_types(
hana::type_c<hana::int_<0>>,
hana::type_c<hana::int_<1>>,
hana::type_c<hana::int_<2>>
),
hanax::make_types(
hana::int_c<3>,
hana::int_c<4>,
hana::int_c<5>
),
hanax::types<
hana::int_<6>,
hana::int_<7>,
hana::int_<8>
>{}
)
)
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.