3

I'm wondering if there is or will be a way in C++ which allows to typedef a template template argument similar to typedef a template argument.

The only way i know of at the moment is using an alias template

template<template<typename> typename T>
struct S {
    template <typename U>
    using TT = T<U>;
};

but that seems too repetitive.

Is there something like

typedef T TT;

or

typename T TT;

to achieve the same?

If not, would it even make sense or am i missing something obvious?

EDIT:

Since this has been marked as possible duplicate i'm trying to rephrase what i'm after.

A typedef creates an alias for one complete type.

An alias template creates an alias for a family of types.

I'm wondering if there is or will be something that creates an alias to a incomplete thing like a template template parameter.

The duplicate question does neither answer whether there is or will be an alternative to the alias template nor if or if not such an alternative would make sense.

ridilculous
  • 624
  • 3
  • 16
  • 4
    `template using TT = T;` is the way to go. – Jarod42 Jun 08 '22 at 07:57
  • @francesco I know about the two but was wondering if there's some language construct equivalent to typedef for template parameter types for template template parameters (maybe i can call them partial or incomplete types?), like a partial typedef, which would save me from defining an alias template for template template parameters where for template parameters a typedef is fine and if there isn't what's the rationale behind. Maybe i'm just too lazy but it feels like the typing for a typedef is much less than for a alias template. – ridilculous Jun 08 '22 at 10:29
  • *if there is* No. *or will be* Apologies, the clairvoyance department has been put an on unpaid leave indefinitely. Currently there seems to be no proposal to address this. Maybe you can write one? – n. m. could be an AI Jul 02 '22 at 10:35
  • @n.1.8e9-where's-my-sharem. i would if i'd know how. Guess i'll try anyway. But it would be good to know if such a thing would even make sense. – ridilculous Jul 04 '22 at 14:15

0 Answers0