PageRenderTime 23ms CodeModel.GetById 13ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/Src/Dependencies/Boost/libs/phoenix/test/scope/bug3289.cpp

http://hadesmem.googlecode.com/
C++ | 37 lines | 21 code | 9 blank | 7 comment | 2 complexity | 51b67f6a728ce4ef1a742cc8bafbc8f1 MD5 | raw file
 1/*==============================================================================
 2    Copyright (c) 2005-2010 Joel de Guzman
 3    Copyright (c) 2010 Thomas Heller
 4
 5    Distributed under the Boost Software License, Version 1.0. (See accompanying
 6    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 7==============================================================================*/
 8#include <algorithm>
 9#include <vector>
10
11#include <boost/detail/lightweight_test.hpp>
12#include <boost/phoenix/core.hpp>
13#include <boost/phoenix/operator.hpp>
14#include <boost/phoenix/scope.hpp>
15#include <boost/phoenix/stl.hpp>
16
17namespace phx = boost::phoenix;
18using namespace boost::phoenix;
19using namespace boost::phoenix::arg_names;
20using namespace boost::phoenix::local_names;
21
22int main()
23{
24    std::vector<int> u(11,1);
25    std::vector<int> w(11,2);
26    std::vector<int>::const_iterator it=w.begin();
27
28    boost::phoenix::generate(phx::ref(u), lambda(_a=*phx::ref(it)++)[_a*2])();
29
30    BOOST_TEST(std::accumulate(u.begin(), u.end(), 0) == 44);
31
32    BOOST_TEST(lambda(_a=*phx::ref(it)++)[_a*2]()() == 4);
33    
34    return boost::report_errors();
35}
36
37