Re: C++ Template Metaprogramming - Exercise 2-0
Dave Abrahams wrote:
Actually there's a much more concise solution using the type traits library. That is, after all, the focus of the chapter.
I believe that would be:
template <typename T>
struct add_const_ref {
typedef add_const
Lemings, Eric B. (Contr) wrote:
Dave Abrahams wrote:
Actually there's a much more concise solution using the type traits library. That is, after all, the focus of the chapter.
I believe that would be:
template <typename T> struct add_const_ref { typedef add_const
::type type; }; Correct me if I'm wrong.
Hint: did you write and compile tests for your code? -- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Dave Abrahams wrote:
Actually there's a much more concise solution using the type traits library. That is, after all, the focus of the chapter.
I believe that would be:
template <typename T> struct add_const_ref { typedef add_const
::type type; }; Correct me if I'm wrong.
Eric.
This will not works because does not add const to references
For example:
add_const
participants (3)
-
David Abrahams
-
Lemings, Eric B. (Contr)
-
Philippe Mori