[Dune] Interface addition

Carsten Gräser graeser at math.fu-berlin.de
Fri Dec 3 13:22:14 CET 2010


Am 03.12.2010 12:31, schrieb Carsten Gräser:
> Am 03.12.2010 11:57, schrieb Markus Blatt:
>> Hi,
>>
>> On Thu, Dec 02, 2010 at 11:39:31PM +0100, Carsten Gräser wrote:
>>> 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>
>>>
>>
>> Generally, yes.
>> I would prefer two distinct objects for the task to improve compile
>> time.
> That's a good point.
> 
>> Further more, you might want to adhere to the boost::fusion naming
>> convention (push_back, push_front). This will save you a lot of time
> I assumed that there must be something similar in MLP or fusion,
> but didn't find it myself. Although push_back, and push_front
> in fusion work a little different since they do not export a
> simple tuple these name would also be fine.
> 
> In view of the discussion on the meeting it should perhaps be named
> PushBack<foo, T>::type and PushFront<foo, T>::type.
> 
>> when C++2x incorporates fusion and you fellow developers, start
>> requesting to move to the new standard. ;)
> No need to wait for fusion in c++2x.
> 
> If the promised time arrives where c++0x is an official standard that
> is implemented by each and every compiler on every cluster you could imagine,
> then we could even remove the template and use the following simple snippet
> directly in the application
> 
> template<class... Args, class T>
> struct PushBack<typename std::tuple<Args...>, T>
> {
>   typedef typename std::tuple<Args...,T> type;
> };
> template<> struct PushBack<> {};
          ^^^^
Of course this has to be:
template<class Tuple, class T> struct PushBack{};

Carsten




More information about the Dune mailing list