2
0
mirror of https://github.com/boostorg/hana.git synced 2026-02-14 12:52:10 +00:00
Files
hana/test/type/trait.cpp

29 lines
920 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/type.hpp>
#include <type_traits>
using namespace boost::hana;
template <typename ...> struct f { };
struct x1; struct x2; struct x3;
int main() {
// make sure the types are good
static_assert(std::is_same<decltype(trait<f>()), f<>>{}, "");
static_assert(std::is_same<decltype(trait<f>(type<x1>)), f<x1>>{}, "");
static_assert(std::is_same<decltype(trait<f>(type<x1>, type<x2>)), f<x1, x2>>{}, "");
static_assert(std::is_same<decltype(trait<f>(type<x1>, type<x2>, type<x3>)), f<x1, x2, x3>>{}, "");
// make sure we can use it; we already made sure the return type was correct
trait<f>();
trait<f>(type<x1>);
trait<f>(type<x1>, type<x2>);
trait<f>(type<x1>, type<x2>, type<x3>);
}