26 Mar
2015
26 Mar
'15
9:23 p.m.
Currently we cannot pass literals directly to an oarchive like this: oarchive << 42; since compilation fails in interface_oarchive.hpp, as the operator<< only takes parameters by reference. We can remedy this by changing operator<< to take the parameter by const-ref instead, as show below. Is there any reason not to do this? --- a/include/boost/archive/detail/interface_oarchive.hpp +++ b/include/boost/archive/detail/interface_oarchive.hpp @@ -59,7 +59,7 @@ public: } template<class T> - Archive & operator<<(T & t){ + Archive & operator<<(const T & t){ this->This()->save_override(t, 0); return * this->This(); }