
10 Jan
2005
10 Jan
'05
3:30 p.m.
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
{ 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. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com