Problems with std::bind when using gcc 4.8.0 with icc 14.0.1.

Problems with std::bind when using gcc 4.8.0 with icc 14.0.1.

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

 

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

sorry for the bad formatting and please ignore the last two lines

 

Leave a Comment

Please sign in to add a comment. Not a member? Join today