Re: Book recommendations: Generic programming
on Wed Mar 14 2007, Jorgen Grahn <grahn+nntp-AT-snipabacken.dyndns.org>
wrote:
On Wed, 14 Mar 2007 03:22:04 CST, Alf P. Steinbach <alfps@start.no> wrote:
Andrei's book (Modern C++ Design) is an excellent introduction: it
opened the field for the public. It doesn't require much in the way of
familiarity with obscure C++ rules, as that's what it explains wherever
necessary. But it /is/ oriented towards an intelligent reader.
I have that one, and also the Abrahams/Gurtovoy book:
%A Andrei Alexandrescu
%T Modern C++ design:
Generic programming and design patterns applied
%S The C++ In-Depth Series
%I Addison-Wesley
%D 2001
%A David Abrahams
%A Aleksey Gurtovoy
%T C++ Template Metaprogramming:
Concepts, Tools, and Techniques
from Boost and Beyond
%S The C++ In-Depth Series
%I Addison-Wesley
%C Boston, MA
%D 2005
Both deal mostly with the implementation of a general-purpose library
though.
We didn't think we were describing the implementation of a
general-purpose library when we wrote the latter book. People
sometimes express frustration that we don't spend time describing how
Boost.MPL is implemented, but we really wanted to stay away from the
nitty-gritty details of how this high-level library is built and focus
on metaprogramming in general and how to use MPL to do it effectively.
Maybe I am lazy or unintelligent ... but it seems to me that
there is a use case for templates in everyday, non-library
development.
Not really, in this sense: the only reason to write templates is that
you plan to use the same code with different types, compile-time
constants, etc. Otherwise, why have template parameters? You could
just write your code with concrete types. A library is just code
that's meant to be re-used in different configurations.
And that neither book covers that explicitly. For someone like me
who hasn't used templates for anything but trivial tasks, reading
these books makes me feel like when I learned BASIC, or functional
programming. It is hard to tell where to start, and what's possible
to do.
You could start at the beginning. Our book is designed to try to
answer those questions if you read it in order :)
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]