Boost logo

Boost :

Subject: Re: [boost] [serialization] Passing literals to oarchive
From: Robert Ramey (ramey_at_[hidden])
Date: 2015-03-30 09:50:56

Bjorn Reese wrote
> I am not sure I follow you. Are you saying that the following does not
> compile?
> template
> <typename T>
> void foo(const T& t) {}
> int main()
> {
> foo(42);
> int x = 42;
> foo(x);
> return 0;
> }

I meant that following won't compile

   template <typename T> void foo(const T& t) {}

   int main()
     return 0;

I just tried to compile this and now I see I was wrong about this. I knew

   template <typename T> void foo( T & t) {}

   int main()
     return 0;

doesn't compile. To me this always made sense since it doesn't make
much sense to take the address of something which is about to disappear
regardless of whether it's "const" or now. My fix was to use
void foo(T && t) which made sense to me - but of course not available
until now.

So make a trac ticket and I'll get around to addressing this.

Robert Ramey

View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at