The following example is a very simple, and contrived, example that
demonstrates the problem I'm seeing.
This fails to compile with 'term does not evaluate to a function taking
1 arguments'.
Is this a problem with bind on MSVC 7.1, or have I just forgotton how to
use it/what it can do.
- Dale.
#include <iostream>
#include <string>
#include
Hi,
Is this a problem with bind on MSVC 7.1, or have I just forgotton how to use it/what it can do.
You're not using bind correctly. See below.
#include <iostream> #include <string> #include
int my_function(std::string const& value) { return static_cast<int>(value.length()); }
int main() { std::string my_string("hello world!"); std::cout << boost::bind<int>(_1, my_string)(my_function); }
You have to change the last line to: std::cout << boost::bind(my_function, _1)(my_string); Regards, Martin ---------------------------------------------------------------- Visit my pages on the Web: XEngine Project Page: http://xengine.sourceforge.net Adelaide Travel Diary: http://adelaidediary.efftrade.at Private homepage: http://members.liwest.at/GroovingArts MP3.com: http://www.mp3.com/GroovingArts
participants (2)
-
Dale Peakall
-
Martin Ecker