|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2003-09-15 15:17:54
On Sep 15, 2003, at 3:36 PM, Daniel Wallin wrote:
> At 19:37 2003-09-15, Eric Friedman wrote:
>> Howard Hinnant wrote:
>> > Like Daniel, I recommend the enable_if pattern here, but I would do
>> it
>> > like:
>> >
>> > struct test_t
>> > {
>> > template <typename T>
>> > test_t(T&, typename enable_if<!is_const<T>::value>::type* =
>> 0)
>> > {
>> > }
>> >
>> > template <typename T>
>> > test_t(T&, typename enable_if<is_const<T>::value>::type* = 0)
>> > {
>> > }
>> > }
>>
>> Unfortunately, this prevents construction from temporaries.
>
> FWIW, the workaround I posted doesn't.
<nod> Right. Your solution is problematic with CodeWarrior Pro 9 /
Mac. It compiles, but both the reference and const reference tests
bind to test_t(const T&).
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk