|
Boost Users : |
From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2005-01-12 08:57:59
David Abrahams wrote:
>Ben Hutchings wrote:
>
>> Well the first attempt doesn't solve the problem because it requires an
>> extra parameter. The second attempt solves it but I don't think you're
>> supposed to make use of other templates.
>
>Any solutions is allowable, though that one is not particularly elegant.
>
>> I think the expected solution
>> would be more like this:
>>
>>
>> template<typename T>
>> struct add_const_ref
>> {
>> typename T const & type;
>> };
>>
>> template<typename T>
>> struct add_const_ref<T &>
>> {
>> typename T & type;
>> };
>
>Actually there's a much more concise solution using the type traits
>library. That is, after all, the focus of the chapter.
>
Remind me not to talk about books I haven't read in future...
Ben.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net