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>
- template<typename T>
- struct Var
- {
- void setMax(int i) {}
- void setMin(int i) {}
- int getMax() { return 0; }
- int getMin() { return 0; }
- };
- namespace impl
- {
- template <typename T1>
- void squeeze(T1 t, int i)
- {
- t.first.setMax(t.second.getMax() - i);
- t.second.setMin(t.first.getMin() + i);
- }
- }
- BOOST_PHOENIX_ADAPT_FUNCTION(void, squeeze, impl::squeeze, 2)
- int main()
- {
- using boost::phoenix::arg_names::_1;
- std::vector<std::pair<Var<int>, Var<double> > > vec;
- std::for_each(vec.begin(), vec.end(), squeeze(_1, 2));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement