2
0
mirror of https://github.com/boostorg/lambda.git synced 2026-01-23 05:32:16 +00:00

added explicit qualification to var to avoid conflict with pthreads

[SVN r25042]
This commit is contained in:
Jaakko Järvi
2004-09-13 15:13:59 +00:00
parent 485bcbdcd8
commit 17df366d20

View File

@@ -22,7 +22,18 @@
#include <vector>
using namespace boost;
using namespace boost::lambda;
using boost::lambda::constant;
using boost::lambda::_1;
using boost::lambda::_2;
using boost::lambda::_3;
using boost::lambda::make_const;
using boost::lambda::for_loop;
using boost::lambda::while_loop;
using boost::lambda::do_while_loop;
using boost::lambda::if_then;
using boost::lambda::if_then_else;
using boost::lambda::if_then_else_return;
// 2 container for_each
template <class InputIter1, class InputIter2, class Function>
@@ -42,7 +53,7 @@ void simple_loops() {
BOOST_TEST(arithmetic_series == 45);
// no body case
for_loop(var(i) = 0, var(i) < 100, ++var(i))();
for_loop(boost::lambda::var(i) = 0, boost::lambda::var(i) < 100, ++boost::lambda::var(i))();
BOOST_TEST(i == 100);
// while loops -------------------------------------------------------
@@ -53,12 +64,12 @@ void simple_loops() {
int count;
count = 0; i = 0;
while_loop(_1++ < 10, ++var(count))(i);
while_loop(_1++ < 10, ++boost::lambda::var(count))(i);
BOOST_TEST(count == 10);
// note that the first parameter of do_while_loop is the condition
count = 0; i = 0;
do_while_loop(_1++ < 10, ++var(count))(i);
do_while_loop(_1++ < 10, ++boost::lambda::var(count))(i);
BOOST_TEST(count == 11);
a = 0;
@@ -89,11 +100,11 @@ void simple_ifs () {
BOOST_TEST(value == 42);
int min;
if_then_else(_1 < _2, var(min) = _1, var(min) = _2)
if_then_else(_1 < _2, boost::lambda::var(min) = _1, boost::lambda::var(min) = _2)
(make_const(1), make_const(2));
BOOST_TEST(min == 1);
if_then_else(_1 < _2, var(min) = _1, var(min) = _2)
if_then_else(_1 < _2, boost::lambda::var(min) = _1, boost::lambda::var(min) = _2)
(make_const(5), make_const(3));
BOOST_TEST(min == 3);