]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/yap/test/compile_x_plus_term.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>
12 using term
= boost::yap::terminal
<boost::yap::expression
, T
>;
15 using ref
= boost::yap::expression_ref
<boost::yap::expression
, T
>;
17 namespace yap
= boost::yap
;
18 namespace bh
= boost::hana
;
21 void compile_x_plus_term()
23 using namespace std::literals
;
25 // char const * string
27 term
<double> unity
{1.0};
30 bh::tuple
<term
<char const *>, ref
<term
<double> &>>>
31 unevaluated_expr
= "3" + unity
;
32 (void)unevaluated_expr
;
35 // std::string temporary
37 term
<double> const unity
{1.0};
40 bh::tuple
<term
<std::string
>, ref
<term
<double> const &>>>
41 unevaluated_expr
= "3"s
+ unity
;
42 (void)unevaluated_expr
;
47 term
<double> unity
{1.0};
51 bh::tuple
<term
<int *>, ref
<term
<double> &>>>
52 unevaluated_expr
= ints
+ unity
;
53 (void)unevaluated_expr
;
57 term
<double> unity
{1.0};
58 int const ints
[] = {1, 2};
61 bh::tuple
<term
<int const *>, ref
<term
<double> &>>>
62 unevaluated_expr
= ints
+ unity
;
63 (void)unevaluated_expr
;
67 term
<double> unity
{1.0};
71 bh::tuple
<term
<int *>, ref
<term
<double> &>>>
72 unevaluated_expr
= std::move(ints
) + unity
;
73 (void)unevaluated_expr
;
78 term
<double> unity
{1.0};
83 bh::tuple
<term
<int *&>, ref
<term
<double> &>>>
84 unevaluated_expr
= int_ptr
+ unity
;
85 (void)unevaluated_expr
;
89 term
<double> unity
{1.0};
90 int const ints
[] = {1, 2};
91 int const * int_ptr
= ints
;
94 bh::tuple
<term
<int const *&>, ref
<term
<double> &>>>
95 unevaluated_expr
= int_ptr
+ unity
;
96 (void)unevaluated_expr
;
100 term
<double> unity
{1.0};
102 int * int_ptr
= ints
;
104 yap::expr_kind::plus
,
105 bh::tuple
<term
<int *>, ref
<term
<double> &>>>
106 unevaluated_expr
= std::move(int_ptr
) + unity
;
107 (void)unevaluated_expr
;
112 term
<double> unity
{1.0};
114 int * const int_ptr
= ints
;
116 yap::expr_kind::plus
,
117 bh::tuple
<term
<int * const &>, ref
<term
<double> &>>>
118 unevaluated_expr
= int_ptr
+ unity
;
119 (void)unevaluated_expr
;
123 term
<double> unity
{1.0};
124 int const ints
[] = {1, 2};
125 int const * const int_ptr
= ints
;
127 yap::expr_kind::plus
,
128 bh::tuple
<term
<int const * const &>, ref
<term
<double> &>>>
129 unevaluated_expr
= int_ptr
+ unity
;
130 (void)unevaluated_expr
;
134 term
<double> unity
{1.0};
136 int * const int_ptr
= ints
;
138 yap::expr_kind::plus
,
139 bh::tuple
<term
<int * const>, ref
<term
<double> &>>>
140 unevaluated_expr
= std::move(int_ptr
) + unity
;
141 (void)unevaluated_expr
;
146 term
<double> unity
{1.0};
149 yap::expr_kind::plus
,
150 bh::tuple
<term
<int &>, ref
<term
<double> &>>>
151 unevaluated_expr
= i
+ unity
;
152 (void)unevaluated_expr
;
156 term
<double> unity
{1.0};
159 yap::expr_kind::plus
,
160 bh::tuple
<term
<int const &>, ref
<term
<double> &>>>
161 unevaluated_expr
= i
+ unity
;
162 (void)unevaluated_expr
;
166 term
<double> unity
{1.0};
169 yap::expr_kind::plus
,
170 bh::tuple
<term
<int>, ref
<term
<double> &>>>
171 unevaluated_expr
= std::move(i
) + unity
;
172 (void)unevaluated_expr
;