C++/0x02-boost

boost example

SpeeDr00t 2016. 8. 1. 11:28
반응형

boost example

1.소스

#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>


using namespace boost::lambda;

int main()
{
    typedef std::istream_iterator<int> in;

    std::for_each(
        in(std::cin), in(), std::cout << (_1 * 3) << " " );

    std::cout << std::endl;
}

결과

hacker@ubuntu:~/cpp$ c++ -I /home/hacker/boost_1_61_0 -o example_boost example_boost.cpp
hacker@ubuntu:~/cpp$ echo 1 2 3 | ./example_boost 
3 6 9 


반응형