C++ Template Metaprogramming -- EX 2.1
I'm going through the excercises in this book and am stumped on the second one I tried. Does anyone have a hint on how to approach this problem? TIA, -K
On Thu, 24 Mar 2005 09:54:36 -0600, Kelly Burkhart
I'm going through the excercises in this book and am stumped on the second one I tried. Does anyone have a hint on how to approach this problem?
Consider types as trees. You have to recurse into the tree, searching for the type you want to replace. I hope it helps. If you're still stuck, I can give you my solution. Regards, Bruno
Bruno Martínez Aguerre
On Thu, 24 Mar 2005 09:54:36 -0600, Kelly Burkhart
wrote: I'm going through the excercises in this book and am stumped on the second one I tried. Does anyone have a hint on how to approach this problem?
Consider types as trees. You have to recurse into the tree, searching for the type you want to replace.
I hope it helps. If you're still stuck, I can give you my solution.
<hint> People who haven't used partial specialization much often have a hard time with this exercise. </hint> -- Dave Abrahams Boost Consulting www.boost-consulting.com
David Abrahams
Bruno Martínez Aguerre
writes: On Thu, 24 Mar 2005 09:54:36 -0600, Kelly Burkhart
wrote: I'm going through the excercises in this book and am stumped on the second one I tried. Does anyone have a hint on how to approach this problem?
Consider types as trees. You have to recurse into the tree, searching for the type you want to replace.
I hope it helps. If you're still stuck, I can give you my solution.
<hint> People who haven't used partial specialization much often have a hard time with this exercise. </hint>
You might want to look at the answers page started by Ariel Badichi: http://tinyurl.com/6e8sv (http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?CPP_Template_...) -- Dave Abrahams Boost Consulting www.boost-consulting.com
On Mon, 2005-03-28 at 08:59, David Abrahams wrote:
David Abrahams
writes: Bruno Martínez Aguerre
writes: On Thu, 24 Mar 2005 09:54:36 -0600, Kelly Burkhart
wrote: I'm going through the excercises in this book and am stumped on the second one I tried. Does anyone have a hint on how to approach this problem?
Consider types as trees. You have to recurse into the tree, searching for the type you want to replace.
I hope it helps. If you're still stuck, I can give you my solution.
<hint> People who haven't used partial specialization much often have a hard time with this exercise. </hint>
You might want to look at the answers page started by Ariel Badichi: http://tinyurl.com/6e8sv
(http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?CPP_Template_...)
Thank you, this will be very helpful as I continue through; it is interesting comparing Ariel's Ch.2 solutions with my own. Thanks for the hints, they did help and I was very pleased when I completed the excercise on my own. -K
Kelly Burkhart
On Mon, 2005-03-28 at 08:59, David Abrahams wrote:
David Abrahams
writes: You might want to look at the answers page started by Ariel Badichi: http://tinyurl.com/6e8sv
(http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?CPP_Template_...)
Thank you, this will be very helpful as I continue through; it is interesting comparing Ariel's Ch.2 solutions with my own.
Thanks for the hints, they did help and I was very pleased when I completed the excercise on my own.
Maybe we should start a "Hints" Wiki page also ;-) -- Dave Abrahams Boost Consulting www.boost-consulting.com
On Mon, 2005-03-28 at 12:42 -0500, David Abrahams wrote:
Thanks for the hints, they did help and I was very pleased when I completed the excercise on my own.
Maybe we should start a "Hints" Wiki page also ;-)
Why not? Have a "FAQ" for each exercise with a "Give me the full answer" link. Stephen
Stephen Torri wrote:
On Mon, 2005-03-28 at 12:42 -0500, David Abrahams wrote:
Thanks for the hints, they did help and I was very pleased when I completed the excercise on my own.
Maybe we should start a "Hints" Wiki page also ;-)
Why not? Have a "FAQ" for each exercise with a "Give me the full answer" link.
Stephen
This could work. We could also use ROT13 on each hint/solution, for example: Hint 1: <rot13 text> Hint 2: <rot13 text> Solution: <rot13 text> But perhaps it's too bothersome (and won't work on people that are used to ROT13).
On Mon, 2005-03-28 at 20:19 +0200, Ariel Badichi wrote:
Why not? Have a "FAQ" for each exercise with a "Give me the full answer" link.
Stephen
This could work. We could also use ROT13 on each hint/solution, for example:
Hint 1:
<rot13 text>
Hint 2:
<rot13 text>
Solution:
<rot13 text>
But perhaps it's too bothersome (and won't work on people that are used to ROT13).
Encrypt each hint/solution pair? Stephen
Stephen Torri
On Mon, 2005-03-28 at 20:19 +0200, Ariel Badichi wrote:
Why not? Have a "FAQ" for each exercise with a "Give me the full answer" link.
Stephen
This could work. We could also use ROT13 on each hint/solution, for example:
Hint 1:
<rot13 text>
Hint 2:
<rot13 text>
Solution:
<rot13 text>
But perhaps it's too bothersome (and won't work on people that are used to ROT13).
Encrypt each hint/solution pair?
That's awfully obtuse, it seems to me. If you want these things to be helpful to people, they should remain easily accessible. -- Dave Abrahams Boost Consulting www.boost-consulting.com
David Abrahams wrote: [rot13 idea snipped]
That's awfully obtuse, it seems to me. If you want these things to be helpful to people, they should remain easily accessible.
I agree. The reasoning behind this idea is that it fulfills two requirements in my mind for incorporating hints: 1) The reader should be able to see one hint at the time (and not see the other hints). 2) The number of pages for each exercise should be minimized. Ideally, there should be only one page per exercise. The idea I presented has the downside of being inconvinient to readers. I don't like it. Perhaps someone else could come up with a better idea? I'd like to emphasize that these requirements are only my opinion. I understand other people may not see them as requirements.
Ariel Badichi
David Abrahams wrote: [rot13 idea snipped]
That's awfully obtuse, it seems to me. If you want these things to be helpful to people, they should remain easily accessible.
I agree. The reasoning behind this idea is that it fulfills two requirements in my mind for incorporating hints:
1) The reader should be able to see one hint at the time (and not see the other hints).
2) The number of pages for each exercise should be minimized. Ideally, there should be only one page per exercise.
I'm not sure that's really important. For each exercise there could be a hint#1...hint#n and solution#1...solution#n
The idea I presented has the downside of being inconvinient to readers. I don't like it. Perhaps someone else could come up with a better idea?
Low-tech solution: "scroll down for next hint" "scroll down for solution" ;-) -- Dave Abrahams Boost Consulting www.boost-consulting.com
David Abrahams
Ariel Badichi
writes: David Abrahams wrote: [rot13 idea snipped]
That's awfully obtuse, it seems to me. If you want these things to be helpful to people, they should remain easily accessible.
I agree. The reasoning behind this idea is that it fulfills two requirements in my mind for incorporating hints:
1) The reader should be able to see one hint at the time (and not see the other hints).
2) The number of pages for each exercise should be minimized. Ideally, there should be only one page per exercise.
I'm not sure that's really important. For each exercise there could be a hint#1...hint#n and solution#1...solution#n
The idea I presented has the downside of being inconvinient to readers. I don't like it. Perhaps someone else could come up with a better idea?
Low-tech solution: "scroll down for next hint" "scroll down for solution"
If you're willing to give up on the goal of "one page per exercise," and would like to go instead with a finer-grained structure, we can accomplish any restructuring you wish through the Wiki's administrative interface; just let us know. -- Dave Abrahams Boost Consulting www.boost-consulting.com
----- Original Message -----
From: "Stephen Torri"
On Mon, 2005-03-28 at 12:42 -0500, David Abrahams wrote:
Thanks for the hints, they did help and I was very pleased when I completed the excercise on my own.
Maybe we should start a "Hints" Wiki page also ;-)
Why not? Have a "FAQ" for each exercise with a "Give me the full answer" link.
Stephen
Well, it would be nice to be able to add comments, alternate solutions or questions for an exercise (instead of editing someone else solution) Philippe
Stephen Torri
On Mon, 2005-03-28 at 12:42 -0500, David Abrahams wrote:
Thanks for the hints, they did help and I was very pleased when I completed the excercise on my own.
Maybe we should start a "Hints" Wiki page also ;-)
Why not? Have a "FAQ" for each exercise with a "Give me the full answer" link.
When I wrote "we," I really meant "someone." The Wiki is open for modification. ;-) -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (6)
-
Ariel Badichi
-
Bruno Martínez Aguerre
-
David Abrahams
-
Kelly Burkhart
-
Philippe Mori
-
Stephen Torri