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 //[hello_world_redux 7 #include <boost/yap/algorithm.hpp> 8 9 #include <iostream> 10 11 12 template <boost::yap::expr_kind Kind, typename Tuple> 13 struct stream_expr 14 { 15 static const boost::yap::expr_kind kind = Kind; 16 17 Tuple elements; 18 19 template <typename T> operator <<stream_expr20 decltype(auto) operator<< (T && x) 21 { return boost::yap::value(*this) << std::forward<T &&>(x); } 22 }; 23 24 main()25int main () 26 { 27 auto cout = boost::yap::make_terminal<stream_expr>(std::cout); 28 cout << "Hello" << ',' << " world!\n"; 29 30 return 0; 31 } 32 //] 33