Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-01-06 05:09:50


Hi,

Aleksey and I are trying to think of a simple metaprogramming
problem which we could use as a sort of "Hello World" example for
the MPL. This seems to be a rather hard problem. Aside from being
short, a C++ "hello, world" introduces only two library components,
cout and endl (three if you count operator<<), the problem it
solves, "printing something", is most programmers will want to do,
and it gives a small rush of excitement when you see it work.

However, it's hard to "see a metaprogram work" except by
error/warning, and it's hard to demonstrate much of any practical
use with a very small number of library components. Some of the
simplest jobs involve numerical computation at compile-time, but I
don't really want to show that right off the bat because:

  a) of the syntactic/mental overhead of using the type wrappers

  b) The eye is easily confused by code which mixes placeholders (e.g.
     "_1") in expressions with numeric constants (e.g. "2").

Thoughts?

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk