|
Boost : |
Subject: Re: [boost] [serialization] rvalues and const-correctness?
From: Robert Ramey (ramey_at_[hidden])
Date: 2008-11-06 16:39:32
Thorsten Ottosen wrote:
> Robert Ramey skrev:
>> David Abrahams wrote:
>
>> Couldn't we add this overload to the
>>> archives, or even simply replace the existing operator with this
>>> one? template<class T>
>>> Archive & operator<<(T const & t){
>>> // ^^^^^------------- Note
>>> this->This()->save_override(t, 0);
>>> return * this->This();
>>> }
>>
>> Aaaa - I would have to spend some time to look into that.
>
> Isn't this the debate we have had so many times?
well, we havn't had it lately.
But this is actually a little different since this is calling a member
function inside serialization. Since save(...) is a const member
funtion, the f() would have to be const. if you can't make f()
const, you've got something to look into.
FYI, the more resent versions of the library implement the
trap where by non-const are serialized as BOOST_STATIC_WARNING
so that you're program will compile and run but emit
this "disclaimer" indicating that my view is that this is really
a bad idea. You're free to ignore the warning whereas
before you couldn't.
Robert Ramey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk