Bjorn Reese wrote
On 03/27/2015 05:49 PM, Robert Ramey wrote:
In this case the problem is different. A parameter value placed on the stack cannot be passed by "const T & t". This syntax assumes and enforces
Why not?
It generates a compile time error when you pass an rvalue.
Now one could add yet one more layer of TMP code to distinguish between tracked and untracked types and handle them differently. But that would introduce another layer of complexity and hide even more what is going on. I would be reluctant to do this.
Making a special case for primitive types is not too bad. See the attached patch.
Since I wrote this, I've been considering it. I looked at your patch. I would likely condition it on the type being a tracked or untracked type rather than being on a primitive type.
I'm presuming that this is not a common case.
I encounter it all the time in unit tests, and occasionally in other code.
the reason I would think that it's not a common case is the following: ar << 42; // put the value of 42 into the archive ... ar >> ?; // what do we do with the result we're retrieving? So I'm not seeing where this comes up. -- View this message in context: http://boost.2283326.n4.nabble.com/serialization-Passing-literals-to-oarchiv... Sent from the Boost - Dev mailing list archive at Nabble.com.