2
0
mirror of https://github.com/boostorg/hana.git synced 2026-02-10 11:32:26 +00:00
Files
hana/example/hello_world.cpp
2014-07-24 15:38:04 -04:00

25 lines
758 B
C++

/*
@copyright Louis Dionne 2014
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
//////////////////////////////////////////////////////////////////////////////
// Important: Keep this file in sync with the Hello World in the README
//////////////////////////////////////////////////////////////////////////////
#include <boost/hana.hpp>
#include <iostream>
#include <string>
using namespace boost::hana;
int main() {
auto xs = list("Hell", int_<0>, std::string{" world"}, '!');
// > "Hell0 world!"
for_each(xs, [](auto x) { std::cout << x; });
// > "Hello world!"
for_each(replace(_ == int_<0>, 'o', xs), [](auto x) { std::cout << x; });
}