Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76553 - in sandbox/closure/libs: closure/example functional/test
From: lorcaminiti_at_[hidden]
Date: 2012-01-17 10:20:42


Author: lcaminiti
Date: 2012-01-17 10:20:41 EST (Tue, 17 Jan 2012)
New Revision: 76553
URL: http://svn.boost.org/trac/boost/changeset/76553

Log:
Adding overload and make_overload to Boost.Functional.
Added:
   sandbox/closure/libs/closure/example/add.cpp (contents, props changed)
   sandbox/closure/libs/functional/test/Jamfile.v2 (contents, props changed)
Properties modified:
   sandbox/closure/libs/functional/test/ (props changed)

Added: sandbox/closure/libs/closure/example/add.cpp
==============================================================================
--- (empty file)
+++ sandbox/closure/libs/closure/example/add.cpp 2012-01-17 10:20:41 EST (Tue, 17 Jan 2012)
@@ -0,0 +1,22 @@
+
+//[example_add_cpp
+#include <boost/closure.hpp>
+#include <algorithm>
+#include <cstdlib>
+
+int main(void) {
+ int sum = 0, factor = 10;
+
+ void BOOST_CLOSURE(int num, const bind factor, bind& sum) {
+ sum += factor * num;
+ } BOOST_CLOSURE_END(add)
+
+ add(1); // Call the function closure.
+
+ int nums[] = {2, 3};
+ std::for_each(nums, nums + 2, add); // Pass the closure to an algorithm.
+
+ return (sum == 60) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+//]
+

Added: sandbox/closure/libs/functional/test/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/closure/libs/functional/test/Jamfile.v2 2012-01-17 10:20:41 EST (Tue, 17 Jan 2012)
@@ -0,0 +1,12 @@
+
+import testing ;
+
+project : requirements
+ <library>/boost//unit_test_framework
+ <link>static
+;
+
+test-suite world_tests :
+ [ run overload.cpp ]
+;
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk