|
Boost Users : |
From: Martin Ecker (martin.ecker_at_[hidden])
Date: 2003-07-30 09:53:48
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 <boost/bind.hpp>
>
> 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
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