|
Boost : |
Subject: Re: [boost] [mini-review] Update of Boost.Assign (13th-19th of June)
From: John Bytheway (jbytheway+boost_at_[hidden])
Date: 2010-06-28 15:30:34
On 19/06/10 15:50, er wrote:
>>
>> template<typename... T> Implementation-defined ref_csv(T&&...)
>
> On second thought, this does not obviate the need for cref_csv (emphasis
> on prefix 'c'), to express intent to cast all arguments to const, would
> it?.
No, although I suspect that use case is small.
>> (there's some wobbles there about how to go from this list of
>> potentially-different Ts to the one true T of the container, but they're
>> not insurmountable)
>
> Do you mean
> int a;
> long b;
> ref_csv_0x(a,b)
> as potentially a problem? So it would for ref_csv, which can be solved
> like this:
> cref_csv<long>(a,b);
> Would not the same apply to ref_csv_0x?
Surprisingly it compiles, but it doesn't do what you want. It captures
the first argument as an rvalue-reference instead of an
lvalue-reference. This works:
ref_csv_0x<long&>(a,b)
but even this only 'by luck'. This for example wouldn't do what you mean:
ref_csv_0x<long&>(b,a)
You'd need to say
ref_csv_0x<long&, long&>(b,a)
> I'm not much familiar with 0x but I'll probably toy with these ideas (I
> have to emulate another OS which tells me that perhaps it's not yet
> mainstream) and I'll update this thread if anything meaningful comes out
> of it.
OK.
John Bytheway
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk