2
0
mirror of https://github.com/boostorg/yap.git synced 2026-02-01 09:02:15 +00:00
Files
yap/example/hello_world_redux.cpp
2016-12-11 23:32:39 -06:00

28 lines
510 B
C++

//[hello_world_redux
#include <boost/yap/expression.hpp>
#include <iostream>
template <boost::yap::expr_kind Kind, typename Tuple>
struct stream_expr
{
static const boost::yap::expr_kind kind = Kind;
Tuple elements;
template <typename T>
decltype(auto) operator<< (T && x)
{ return boost::yap::value(*this) << std::forward<T &&>(x); }
};
int main ()
{
auto cout = boost::yap::make_terminal<stream_expr>(std::cout);
cout << "Hello" << ',' << " world!\n";
return 0;
}
//]