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/algorithm.hpp> 7 8 #include <array> 9 #include <iostream> 10 11 12 //[ minimal_template 13 template <boost::yap::expr_kind Kind, typename Tuple> 14 struct minimal_expr 15 { 16 static const boost::yap::expr_kind kind = Kind; 17 18 Tuple elements; 19 }; 20 //] 21 22 main()23int main() 24 { 25 //[ minimal_template_manual_construction 26 auto left = boost::yap::make_terminal<minimal_expr>(1); 27 auto right = boost::yap::make_terminal<minimal_expr>(41); 28 29 auto expr = boost::yap::make_expression< 30 minimal_expr, 31 boost::yap::expr_kind::plus 32 >(left, right); 33 //] 34 35 //[ minimal_template_evaluation 36 auto result = boost::yap::evaluate(expr); 37 38 std::cout << result << "\n"; // prints "42" 39 //] 40 41 return 0; 42 } 43