1 // Copyright (C) 2016-2018 T. Zachary Laine 2 // 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> 7 8 9 template<typename T> 10 using term = boost::yap::terminal<boost::yap::expression, T>; 11 12 template<long long I> 13 using place_term = 14 boost::yap::terminal<boost::yap::expression, boost::yap::placeholder<I>>; 15 16 template<typename T> 17 using ref = boost::yap::expression_ref<boost::yap::expression, T>; 18 19 namespace yap = boost::yap; 20 namespace bh = boost::hana; 21 22 compile_placeholders()23void compile_placeholders() 24 { 25 using namespace boost::yap::literals; 26 27 { 28 place_term<1> p1 = 1_p; 29 (void)p1; 30 } 31 32 { 33 place_term<1> p1 = 1_p; 34 term<double> unity{1.0}; 35 yap::expression< 36 yap::expr_kind::plus, 37 bh::tuple<ref<place_term<1> &>, ref<term<double> &>>> 38 expr = p1 + unity; 39 (void)expr; 40 } 41 42 { 43 place_term<1> p1 = 1_p; 44 yap::expression< 45 yap::expr_kind::plus, 46 bh::tuple<ref<place_term<1> &>, place_term<2>>> 47 expr = p1 + 2_p; 48 (void)expr; 49 } 50 } 51