mirror of
https://github.com/boostorg/more.git
synced 2024-12-26 23:30:29 +08:00
3c82e58140
[SVN r36493]
850 B
850 B
Build a Simple Program Using Boost
To keep things simple, let's start by using a header-only library. The following program reads a sequence of integers from standard input, uses Boost.Lambda to multiply each number by three, and writes them to standard output:
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " " );
}
Copy the text of this program into a file called
example.cpp
.