- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
I have problems compiling the following code where a public method foo2 of class Bar uses std::bind on another such method foo. I am using icc 14.0.1 20131008 and gcc 4.8.0
//compile with: icc main.cpp -std=c++11 #include <vector> #include <iostream> #include <functional> class Bar { public: void foo(double x, double y) { std::cout << x << std::endl; std::cout << y << std::endl; } void foo2(double x) { using namespace std::placeholders; auto function = std::bind(&Bar::foo, this, x, _1); function(0); } }; int main(int argc, char **argv) { Bar bar; bar.foo2(1); }
The error message reads:
error: no instance of overloaded function "std::_Bind<_Functor (_Bound_args...)>::operator() [with _Functor=std::_Mem_fn<void (Bar::*)(double, double)>, _Bound_args=<Bar *, double, std::_Placeholder<1>>]" matches the argument list argument types are: (int) object type is: std::_Bind<std::_Mem_fn<void (Bar::*)(double, double)> (Bar *, double, std::_Placeholder<1>)> function(0);
I am not having this problem using the same Intel Compiler but with gcc 4.7.2 instead
Thanks for your help!
I am using icc 14.0.1 20131008 and
gcc 4.7.2 20130108, icc 14.0.1 20131008, boost 1_49
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sorry for the bad formatting and please ignore the last two lines
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page