Hi, Suppose I have the following code: template< typename T > void DoFoo( int number, T object ) { } void main() { std::liststd::string myStrings; // Assume myStrings is full of something... std::for_each( myStrings.begin(), myStrings.end(), boost::bind( &DoFoo, 5, _1 ) ); } On MSVC 9, this will not compile because DoFoo is a template, and at some point, boost::bind can't take a template as the function to call, or it can't deduce the function's template arguments. Is there a way I can make this work? Thanks.
Hi,
Suppose I have the following code:
template< typename T > void DoFoo( int number, T object ) { }
void main() { std::liststd::string myStrings;
// Assume myStrings is full of something...
std::for_each( myStrings.begin(), myStrings.end(), boost::bind( &DoFoo, 5, _1 ) ); }
On MSVC 9, this will not compile because DoFoo is a template, and at some point, boost::bind can't take a template as the function to call, or it can't deduce the function's template arguments. Is there a way I can make this work? Thanks.
Would this work? std::for_each( myStrings.begin(), myStrings.end(), boost::bind( &DoFoostd::string, 5, _1 ) ); -- -- Marshall Marshall Clow Idio Software mailto:marshall@idio.com It is by caffeine alone I set my mind in motion. It is by the beans of Java that thoughts acquire speed, the hands acquire shaking, the shaking becomes a warning. It is by caffeine alone I set my mind in motion.
participants (2)
-
Marshall Clow
-
Robert Dailey