Boost logo

Boost :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2006-08-06 07:10:17


AlisdairM wrote:
> Ion Gaztañaga wrote:
>
>> It would be also nice a way to define a tuple of N objects of the
>> same type: auto tup = make_tuple_n<bool, 6>;
>
> Isn't this spelled:
>
> std::tr1::array< bool, 6 > tup; ?
>
> tr1 array should supply everything necessary to act as a homogeneous
> tuple, other than using the actual name 'tuple' - which I guess could
> show up in some template specialization cases.

Yes, I'm reinventing the wheel ;-). And I could surely iterate over it!
The tuple approach should be maybe used when the function unrolling has
a different return type:

template<class T>
T multiply(T t){ return T*=2; }

template<typename... Values>
auto multiply_and_pack(const Values&... values) -> decltype(/**/){
     auto ret_tuple = variadic_unroll(multiply(values));
     return ret_tuple;
}

And what if Values parameter pack is instantiated as a sequence of the
same type? Should we make tuple<int, int> and array<int, 2> the same type?

Regards,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk