Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <boost/phoenix/core.hpp>
- #include <boost/phoenix/function.hpp>
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- #define USE_PHOENIX
- #if defined(USE_PHOENIX)
- namespace impl
- {
- void plus4(int i, bool b, long l, std::string const & s)
- {
- std::cout << (i + l) << std::endl;
- }
- }
- BOOST_PHOENIX_ADAPT_FUNCTION(void, plus4, impl::plus4, 4)
- #endif
- int main()
- {
- using boost::phoenix::arg_names::_1;
- bool b = true;
- long l = 999;
- std::string const s = "Hello";
- std::vector<int> vec;
- vec.push_back(1);
- vec.push_back(2);
- vec.push_back(3);
- #if defined(USE_PHOENIX)
- std::for_each(vec.begin(), vec.end(), plus4(_1, b, l, s));
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement