]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/yap/test/compile_is_expr.cpp
1 // Copyright (C) 2016-2018 T. Zachary Laine
3 // Distributed under the Boost Software License, Version 1.0. (See
4 // accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 #include <boost/yap/expression.hpp>
9 namespace yap
= boost::yap
;
11 struct alternate_expr_1
13 static const yap::expr_kind kind
= yap::expr_kind::plus
;
14 boost::hana::tuple
<> elements
;
17 struct alternate_expr_2
19 static const yap::expr_kind kind
= yap::expr_kind::plus
;
20 boost::hana::tuple
<int, double> elements
;
29 boost::hana::tuple
<int, double> elements
;
34 static const int kind
= 0;
35 boost::hana::tuple
<int, double> elements
;
41 boost::hana::tuple
<int, double> elements
;
46 static const yap::expr_kind kind
= yap::expr_kind::plus
;
51 static const yap::expr_kind kind
= yap::expr_kind::plus
;
56 void compile_is_expr()
59 yap::is_expr
<yap::terminal
<yap::expression
, double>>::value
, "");
62 yap::is_expr
<yap::terminal
<yap::expression
, double> const>::value
, "");
64 yap::is_expr
<yap::terminal
<yap::expression
, double> const &>::value
,
67 yap::is_expr
<yap::terminal
<yap::expression
, double> &>::value
, "");
69 yap::is_expr
<yap::terminal
<yap::expression
, double> &&>::value
, "");
72 using namespace yap::literals
;
73 static_assert(yap::is_expr
<decltype(1_p
)>::value
, "");
77 yap::is_expr
<yap::expression
<
78 yap::expr_kind::unary_plus
,
79 boost::hana::tuple
<yap::terminal
<yap::expression
, double>>>>::value
,
82 yap::is_expr
<yap::expression
<
85 yap::terminal
<yap::expression
, double>,
86 yap::terminal
<yap::expression
, double>>>>::value
,
89 static_assert(yap::is_expr
<alternate_expr_1
>::value
, "");
90 static_assert(yap::is_expr
<alternate_expr_2
>::value
, "");
92 static_assert(!yap::is_expr
<int>::value
, "");
93 static_assert(!yap::is_expr
<non_expr_1
>::value
, "");
94 static_assert(!yap::is_expr
<non_expr_2
>::value
, "");
95 static_assert(!yap::is_expr
<non_expr_3
>::value
, "");
96 static_assert(!yap::is_expr
<non_expr_4
>::value
, "");
97 static_assert(!yap::is_expr
<non_expr_5
>::value
, "");
98 static_assert(!yap::is_expr
<non_expr_6
>::value
, "");