1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
// Copyright (C) 2016-2018 T. Zachary Laine
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/yap/expression.hpp>
template<typename T>
using term = boost::yap::terminal<boost::yap::expression, T>;
template<typename T>
using ref = boost::yap::expression_ref<boost::yap::expression, T>;
namespace yap = boost::yap;
namespace bh = boost::hana;
void compile_const_term()
{
{
term<double const> unity{1.0};
int i_ = 42;
term<int &&> i{std::move(i_)};
yap::expression<
yap::expr_kind::plus,
bh::tuple<ref<term<double const> &>, term<int &&>>>
expr = unity + std::move(i);
yap::expression<
yap::expr_kind::plus,
bh::tuple<
ref<term<double const> &>,
yap::expression<
yap::expr_kind::plus,
bh::tuple<ref<term<double const> &>, term<int &&>>>>>
unevaluated_expr = unity + std::move(expr);
(void)unevaluated_expr;
}
{
term<double> const unity{1.0};
int i_ = 42;
term<int &&> i{std::move(i_)};
yap::expression<
yap::expr_kind::plus,
bh::tuple<ref<term<double> const &>, term<int &&>>>
expr = unity + std::move(i);
yap::expression<
yap::expr_kind::plus,
bh::tuple<
ref<term<double> const &>,
yap::expression<
yap::expr_kind::plus,
bh::tuple<ref<term<double> const &>, term<int &&>>>>>
unevaluated_expr = unity + std::move(expr);
(void)unevaluated_expr;
}
{
term<double> unity{1.0};
int i_ = 42;
term<int const &> i{i_};
yap::expression<
yap::expr_kind::plus,
bh::tuple<ref<term<double> &>, term<int const &>>> const expr =
unity + std::move(i);
yap::expression<
yap::expr_kind::plus,
bh::tuple<
ref<term<double> &>,
yap::expression<
yap::expr_kind::plus,
bh::tuple<ref<term<double> &>, term<int const &>>>>>
unevaluated_expr = unity + std::move(expr);
(void)unevaluated_expr;
}
}
|