
2014-02-21 10:31 GMT+01:00 Vladimir Batov
Andrzej Krzemienski
writes: ... If you added MoveConstructible requirement (I am not saying you should, I am just exploring the possibility), you would be probably saying "It also works with non-CopyConstructible but MoveConstructible types, but in that case there is a limited number of ways Boost.Convert's interface can be used." The above example would not work, but the following one should: convertstd::string::from(12345, cnv).value_or("bummer");
That is, you do not care that a temporary's internal value is moved from. But this may not be implementable in C++03. I guess we do not know how to emulate rvalue references for *this. However, the following should be easy to implement:
convertstd::string::from(12345, cnv).value();
For some background, move semantics obtained a nice language support in C++11, but it is also available in C++03 for some extent. This is why we have Boost.Move. I will try to add move semantics to Boost.Optional, so that you can use it.
RE: convert<>::from().value();
This one is fine as it returns a const reference (unless it throws. So, no additional requirements whatsoever... right?
Well, now that I think of it: implementing it may also require "rvalue references from *this" feature, which may not be implementable in C++03.
RE: MoveConstructible
I do think that your clarifications should be in the docs and Rob's std::move() deployment in the code. Still, I feel that this sort of detailed explanations/clarifications/implementation could wait... until we decide if we want to proceed any further with "convert"... I just do not want our effort wasted. I hope you understand my hesitation.
Agreed.