• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright Louis Dionne 2013-2017
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4 
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/fold_left.hpp>
7 #include <boost/hana/tuple.hpp>
8 
9 #include <sstream>
10 namespace hana = boost::hana;
11 
12 
__anondfa0f6860102(auto x) 13 auto to_string = [](auto x) {
14     std::ostringstream ss;
15     ss << x;
16     return ss.str();
17 };
18 
__anondfa0f6860202(auto x, auto y) 19 auto show = [](auto x, auto y) {
20     return "(" + to_string(x) + " + " + to_string(y) + ")";
21 };
22 
main()23 int main() {
24     BOOST_HANA_RUNTIME_CHECK(
25         hana::fold_left(hana::make_tuple(2, "3", '4'), "1", show) == "(((1 + 2) + 3) + 4)"
26     );
27 }
28