Boost logo

Boost :

Subject: Re: [boost] boost::bind C2664 error with two non-const references
From: Nicolas FRANCOIS (nicolas.francois_at_[hidden])
Date: 2015-05-22 10:05:05


Does BOOST_NO_CXX11_RVALUE_REFERENCES is defined ?
I managed to make it work defining it, but when it is not defined then the code goes to line 917 of bind.hpp; and it does not work because of the list_add_cref function which cast the reference in a const one.


Le 22 mai 2015 à 14:53, Peter Dimov <lists_at_[hidden]<mailto:lists_at_[hidden]>> a écrit :

Nicolas FRANCOIS wrote:
Using VS2013 and yes the code I gave is only a non-working sample code to expose the problem.
Working with VS2013 on boost 1.58.0 release.

The code still compiles for me; VS2013, boost- 1.58.0.

Le 22 mai 2015 à 13:12, Peter Dimov <lists_at_[hidden]<mailto:lists_at_[hidden]>> a écrit :

Nicolas FRANCOIS wrote:
#include <boost/bind.hpp>
#include <boost/function.hpp>

struct A {
void f(int&, std::vector<int*>&);
};

int main(){
A a;
auto f = boost::bind(&A:f, &a, _1, _2);
}

results in error C2664: cannot convert from 'const std::vector<int*> &' to 'std::vector<int*> &'

This code (after #include <vector> and A:f -> A::f) works for me under VS2013 and the current develop branch. What compiler are you using?

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk