Boost logo

Boost :

Subject: [boost] [Functional/Factory] Value factory not accepts rvalues?
From: Lin, Yi-Li (record.nctu.cis91_at_[hidden])
Date: 2013-11-12 02:34:22


I found that boost::value_factory did not accept rvalues
in some case.

In my case, temporary value is produced and passed to
value factory directly.
But boost::value_factory<T>::operator() did not accept rvalue,
they take lvaue reference instead.
Maybe it'll be better to provide another version of operator
takes const lvalue? (Additionally, use std::forward to forward
universal reference in C++11?)

Sample code which compiler complains:
int get_value();
struct var {
             var( );
    explicit var(int);
};

void caller() {
    boost::value_factory<var> f;

    f(get_value());
}


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