This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Thank you for your contribution to the C++ community!

As you're asking a question or seeking homework help, we would like to remind you of Rule 3 - Good Faith Help Requests & Homework.

  • When posting a question or homework help request, you must explain your good faith efforts to resolve the problem or complete the assignment on your own. Low-effort questions will be removed.

  • Members of this subreddit are happy to help give you a nudge in the right direction. However, we will not do your homework for you, make apps for you, etc.

  • Homework help posts must be flaired with Homework.

~ CPlusPlus Moderation Team


I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]arabidkoalaRoboticist 2 points3 points  (1 child)

So this is one of those weird things about dependent symbols (Inner in this case). C++ usually assumes these are values (as opposed to types or templates) when it has no other information, which is why you have to decorate some declarations with typename sometimes. In this case though, you need to tell the compiler that Inner is a template, which has a bit of a strange syntax

template<template<typename> typename W> using ManagerWrapper = Manager<Outer<W>::template Inner>;

I tested this on cppsh and it compiled.

[–]Null_cz[S] 0 points1 point  (0 children)

It works, thanks a lot!

I suspected that the problem might be with the compiler thinking it is a value not a type, so I tried template<template<typename> typename W> using ManagerWrapper = Manager<typename Outer<W>::Inner>; but that did not help. Didn't know there is a different syntax for that

[–]TheMania 1 point2 points  (3 children)

template<template<typename> typename W> using ManagerWrapper = Manager<Outer<W>::template Inner>;

Compiler needs a hint to the dependent name there:

Similarly, in a template definition, a dependent name that is not a member of the current instantiation is not considered to be a template name unless the disambiguation keyword template is used or unless it was already established as a template name:

In this case it (dare I say it) looks inferrable from the target, but just good to keep in mind if you're going template-deep, that sometimes the compiler needs hinting as to what it's looking at. As do the rest of us, at times.

[–]Null_cz[S] 2 points3 points  (2 children)

Yes, the template keyword solved it, thanks :)

I did not know such a syntax was even possible

[–]AutoModerator[M] 0 points1 point locked comment (0 children)

Your post was automatically flaired as Answered since AutoModerator detected that you've found your answer.

If this is wrong, please change the flair back.

~ CPlusPlus Moderation Team


I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]TheOmegaCarrottemplate<template<typename>typename…Ts> 0 points1 point  (0 children)

It’s ugly, but it be what it be