mirror of
https://github.com/boostorg/hana.git
synced 2026-02-15 13:12:12 +00:00
29 lines
1.1 KiB
C++
29 lines
1.1 KiB
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/type.hpp>
|
|
|
|
#include <boost/hana/detail/static_assert.hpp>
|
|
|
|
#include <type_traits>
|
|
using namespace boost::hana;
|
|
|
|
|
|
template <typename ...> struct f { struct type; };
|
|
struct x1; struct x2; struct x3;
|
|
|
|
int main() {
|
|
BOOST_HANA_STATIC_ASSERT(metafunction<f>() == type<f<>::type>);
|
|
BOOST_HANA_STATIC_ASSERT(metafunction<f>(type<x1>) == type<f<x1>::type>);
|
|
BOOST_HANA_STATIC_ASSERT(metafunction<f>(type<x1>, type<x2>) == type<f<x1, x2>::type>);
|
|
BOOST_HANA_STATIC_ASSERT(metafunction<f>(type<x1>, type<x2>, type<x3>) == type<f<x1, x2, x3>::type>);
|
|
|
|
static_assert(std::is_same<decltype(metafunction<f>)::apply<>, f<>>::value, "");
|
|
static_assert(std::is_same<decltype(metafunction<f>)::apply<x1>, f<x1>>::value, "");
|
|
static_assert(std::is_same<decltype(metafunction<f>)::apply<x1, x2>, f<x1, x2>>::value, "");
|
|
static_assert(std::is_same<decltype(metafunction<f>)::apply<x1, x2, x3>, f<x1, x2, x3>>::value, "");
|
|
}
|