Using bind1st for a method that takes argument by reference

后端 未结 4 1084
悲哀的现实
悲哀的现实 2020-12-01 20:59

I have a struct like this:

struct A {
    void i(int i) {}
    void s(string const &s) {}
};

Now when I try this:

bind         


        
4条回答
  •  臣服心动
    2020-12-01 21:46

    The issue is a defect in the library specification.

    Take a look at this bug report against gcc and the resulting discussion: Bug 37811 - bind1st fails on mem_fun with reference argument

    C++03 lacked the facilities to build a perfect bind library. This issue is fixed in C++11 with perfect forwarding and std::bind.

提交回复
热议问题