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 <powerprogman-AT-yahoo.com> 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.
https://svn.boost.org/svn/boost/sandbox/icl/boost/validate/loki_xt/Tuple.h

Cheers,
Joachim

[1] Alexandrescu, Andrei: Modern C++ Design. Addison-Wesley, 2001.
[2] Joachim Faulhaber: Boost.Alabaster. A Law Based Tester, BoostCon 2010.
https://svn.boost.org/svn/boost/sandbox/icl/libs/validate/doc/boostcon2010/BoostAlabaster.pdf

-- 
Interval Container Library [Boost.Icl]
http://www.joachim-faulhaber.de

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net