Boost logo

Boost Users :

Subject: Re: [Boost-users] Metaprogramming + Multiple Inheritance?
From: Joachim Faulhaber (afojgo_at_[hidden])
Date: 2011-09-05 15:29:30

2011/9/5 Dave Abrahams <dave_at_[hidden]>:
> on Sun Sep 04 2011, Hossein Haeri <> wrote:
>> Hi Dave,
>> There is a fine line between Generic Programming in general and
>> metaprogramming. My personal feeling is that Andrei's works -- and PBD
>> in general -- are good instances for Generic Programming. Yet, I don't
>> seem to register them per se as metaprogramming. I understand that
>> this might be a very personal viewpoint. I say this because I had a
>> try and couldn't quite put my reasons into words.
> Andrei isn't focusing on metaprogramming (nor on generic programming as
> I understand the term); but he is _applying_ metaprogramming techniques
> to classic OO design patterns (such as visitor).  As such that makes a
> very good example of what you're asking about.

Another brilliant combination of metaprogramming and multiple
inheritance is Andrei's example on generating classes and class
hierarchies from typelists [1](pp. 64-76). This technique is not only
a nifty way of using metaprogramming. I also found it very useful for
defining a polymorphic tuple class template. I used this approach to
implement an axiom based test machine [2], where the tuple of free
variables (of arbitrary types) that occur in an axiom are implemented
using Andrei's typelist generated class approach.


[1] Alexandrescu, Andrei: Modern C++ Design. Addison-Wesley, 2001.
[2] Joachim Faulhaber: Boost.Alabaster. A Law Based Tester, BoostCon 2010.

Interval Container Library [Boost.Icl]

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at