Boost logo

Boost :

From: Emily Winch (emily_at_[hidden])
Date: 2001-11-22 10:04:24

> > At the moment I can't think of a practical situation in which
> > it would be useful to pass super_subclass as a template template
> > parameter, but it might be worth keeping in mind.
> Here is one example:
> #include "boost/mpl/remove_if.hpp"
> #include "boost/mpl/type_list.hpp"
> #include "boost/mpl/make_fun.hpp"
> #include "boost/mpl/bind.hpp"
> #include "boost/type_traits/same_traits.hpp"
> #include "boost/type_traits/conversion_traits.hpp"
> namespace mpl = boost::mpl;
> template<typename T1, typename T2>
> struct super_subclass
> {
> BOOST_STATIC_CONSTANT(bool, value = (
> boost::is_convertible<T2 const*, T1 const*>::value
> && boost::is_same<T1 const*, void const*>::value
> ));
> };
> typedef mpl::type_list<...> types; // something meaningful :)
> typedef mpl::remove_if<
> types
> , mpl::bind1st<mpl::make_f_xy<super_subclass>,T>
> >::sequence result;
> >
> I am not claim that the above code has any practical value, of course :).
> But if you replace 'remove_if' with 'find_if', or 'count_if', or 'sort',
> etc. (see boost/mpl for the complete list of the algorithms :) - it might.

Yes, it was the practical value that I was missing :) But, practical value
or not, it makes sense that all functions over types have a consistent

> BTW, Emily, I've read you paper
> (, and I am impressed both by
> work you did, and by the fact how close an independent work of two people
> can be ;). As Dave has already mentioned, a little while ago I too wrote a

> couple of simple tuple extensions
> (, some of which, as
> know now, are scarily close to what your paper describes :). Of course,
> work is much more thought-out than mine (I've spent only a few days on the

> whole topic :), but if you are interested to cooperate - I would be more
> than happy!

Last night I finally managed to spend some time looking at mpl and at the
tuple extension stuff. Well, it hurts my head :) Some documentation would be
really useful! I forgot how much I rely on an understanding of idioms when
reading code, until I read yours, which appears to be based on idioms I
don't yet grok.

There is certainly a lot in common between the functionality of my tuple
stuff and your typelist stuff. There seems to be less commonality in the
approaches we are using to get there, which is a shame.

So, my current plan is to spend some more time looking at your stuff, but
mainly to get mine up to scratch and make it available so that there is
something concrete to discuss. At that point, any comments would be
extremely welcome, and things can move from there.

I got slightly sidetracked from tidying into making tuply
[i|o]stream_iterators, but those are pretty much done now.


Boost list run by bdawes at, gregod at, cpdaniel at, john at