[Dune] Interface addition

Jö Fahlke jorrit at jorrit.de
Fri Dec 3 12:26:40 CET 2010


Am Thu,  2. Dec 2010, 23:39:31 +0100 schrieb Carsten Gräser:
> Dear Dune,
> I'd like to add helper template ExtendedTuple to prepend or append a type
> to a tuple to tupleutility.hh. It provides the types:
> 
> ExtendedTuple<tuple<T1,...,TN>,T>::prepended  ==  tuple<T,T1,...,TN>
> ExtendedTuple<tuple<T1,...,TN>,T>::appended   ==  tuple<T1,...,TN,T>
> 
> Any objections to add this utility template in the attached patch?

In general, I welcome this functionality.  I would like to see something more
general as the user interface however.  For instance

  template<class Tuple1, class Tuple2>
  struct TupleCat {
    typedef tuple<[elements of Tuple1], [elements of Tuple2]> type;
  };

or the same, but with an arbitrary number of tuples, or

  template<class TupleOfTuples>
  struct FlattenTuple {
    typedef tuple<[elements of the first Tuple], [elements of the second
            Tuple], ...> type;
  };

I do realize that this is a lot more complicated, so consider this a
nice-to-have, but ignore this if you don't feel like implementing it.

If you stay with your original idea, I would support Markus idea of having to
seperate utility classes for prepend and append instead of one.

And finally, please have a look at the static_assert message, the final
sentence about a tuple of pointers appears to be left over from copy-n-paste.


-- 
Warum die Sonne verboten werden sollte: http://www.bastiat.de unter
"Petition".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20101203/42006073/attachment.sig>


More information about the Dune mailing list