|
Boost Users : |
From: Markus Werle (yg-boost-users_at_[hidden])
Date: 2003-06-27 03:50:17
<posted & mailed>
Markus Werle wrote:
> OK, that's a solution.
No it is not :-(
still having problems with template functions:
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/if.hpp"
#include "boost/lambda/exceptions.hpp"
#include "boost/lambda/casts.hpp"
#include "boost/lambda/algorithm.hpp"
#include "boost/lambda/bind.hpp"
#include "boost/mpl/select2nd.hpp"
template <class T>
inline
std::string Foo(const T& t) {}
template<class It, class F> void for_each_pair(It first, It last, F f)
{
for(; first != last; ++first) f(first->first, first->second);
}
double Double(double d) { return 2.0 * d; }
int main()
{
namespace l = boost::lambda;
std::map<int, double> M;
M[1] = 5.0;
M[3] = 7.0;
for_each_pair(M.begin(), M.end(),
l::bind(&Double, l::_2));
// THIS HERE FAILS TO COMPILE!
for_each_pair(M.begin(), M.end(),
l::bind(&Foo<std::string>, l::_2));
}
Markus
-- Build your own Expression Template Library with Daixtrose! Visit http://daixtrose.sourceforge.net/
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net