summaryrefslogtreecommitdiff
path: root/more/getting_started/detail/build-simple-head.rst
diff options
context:
space:
mode:
Diffstat (limited to 'more/getting_started/detail/build-simple-head.rst')
-rw-r--r--more/getting_started/detail/build-simple-head.rst28
1 files changed, 28 insertions, 0 deletions
diff --git a/more/getting_started/detail/build-simple-head.rst b/more/getting_started/detail/build-simple-head.rst
new file mode 100644
index 0000000000..487610e344
--- /dev/null
+++ b/more/getting_started/detail/build-simple-head.rst
@@ -0,0 +1,28 @@
+.. Copyright David Abrahams 2006. Distributed under the Boost
+.. Software License, Version 1.0. (See accompanying
+.. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+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``.
+