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 //[ calc2b 7 #include <boost/yap/expression.hpp> 8 9 #include <iostream> 10 11 main()12int main () 13 { 14 using namespace boost::yap::literals; 15 16 // Displays "5" 17 std::cout << make_expression_function(1_p + 2.0)(3.0) << std::endl; 18 19 // Displays "6" 20 std::cout << make_expression_function(1_p * 2_p)(3.0, 2.0) << std::endl; 21 22 // Displays "0.5" 23 std::cout << make_expression_function((1_p - 2_p) / 2_p)(3.0, 2.0) << std::endl; 24 25 return 0; 26 } 27 //] 28