C++ Logo

std-proposals

Advanced search

Re: [std-proposals] operator typename+ (Tuple -> ParamPack)

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Tue, 14 Nov 2023 23:40:57 +0000
Copying the author of P1858 on this email.

Barry, in your paper you propose that a tuple type, for example:

    typedef std::tuple<int, char, float> MyTupleType;

could be turned into a parameter pack with the following syntax:

    MyTuple::[:]

Had you considered providing a language feature that would get you _all_ of
the template parameters, including the constants? Let's say the syntax for
this would be:

    MyTuple+

So for example consider the following code snippet:

    template<int i, int j, int k, typename A> class SomeClass1 { /*
constructor needed in here */ };
    template<int i, int j, int k, typename A> class SomeClass2 {};

    typedef SomeClass2<4,5,6,long> Monkey;

    auto &Func(Monkey const &arg)
    {
        static SomeClass1< Monkey+ > obj(arg);
        return obj;
    }

So here 'Monkey+' would expand to:

    int, int, int, typename

I suppose this would have to be a new kind of hybrid parameter pack (hybrid
meaning it contains both constants and types).


On Sunday, November 12, 2023, Bjorn Reese via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 11/12/23 18:15, Frederick Virchanza Gotham via Std-Proposals wrote:
>
> The operator, typename+ , turns a tuple into a parameter pack. Or it can
>> turn a variant into a parameter pack. Or any template class into a
>> parameter pack.
>>
>
> Already covered by P1858, section 4.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2023-11-14 23:41:00