170 похожих чатов

X takes a template template parameter[1], meaning that any template

argument for X needs to itself take a template parameter. For instance, you cannot do X<int>, but you can do X<Y>, since Y itself is a template. There are two definitions of X, first the general template one, then the specialization X<Y>.

Y is a normal template.

Z is a template alias declaration, meaning that Z is now an alias for Y (think of template aliases as a "typedef for templates").

Now let's look at main():
Defining a variable of type X<Y> uses that specialization (printing 2). But what happens when we use a template alias, as in X<Z>? Is the specialization X<Y> still used, since Z is an alias for Y?

No. According to §14.5.7¶1 in the standard, a template alias declaration resolve to a new family of types. The specialization cannot be used, and the first template delcaration is used instead, printing 1.

[1]: For a good introduction to template template parameters, s

2 ответов

9 просмотров

Спасибо, я поразбираюсь сегодня ночью

Нет, все-таки это баг кланга https://bugs.llvm.org/show_bug.cgi?id=26093

Похожие вопросы

Обсуждают сегодня

А чем вам питонисты не угодили?😂
.
79
Язык Си можно выучить за день? По книжке ANSI C на 230 страниц
Vincent Vegan
29
Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
75
Dim Dim, [02.07.2024 11:07] DB 0x62 Dim Dim, [02.07.2024 11:07] DB 0x66 Dim Dim, [02.07.2024 11:07] кто пояснит что это?
Dim Dim
14
Ошибка: segmentation fault (core dumped) Код: pastebin.com/BEsNNSSV Сообщение от компилятора: отсутствует ОС: Arch Linux Ядро: x86_64 Linux 6.9.7-arch1-1 Процессор: Intel Cele...
sec
4
Ребят, а за скок можно впарить анон чат с апишкой и веб админкой ?
Eugene Неелов
15
@ahndmn @ayaw0_0 здарова, на чем пишете?
Aiwan \ (•◡•) / _bot
7
Кстати, я тут еще с одной темой столкнулся, вот учу я C++, на таком то ресурсе, а остальные постоянно советуют практиковаться, что то писать, проекты, но как писать если вот т...
aaswq1
7
Ещё такой вопрос. Мне необходимо хранить пароль пользователя локально. Для этого планирую использовать ini файл. Это для автозаполнения полей логин и пароль при авторизации. Е...
Евгений
19
с помощью чего можно бота добавить как админа в чат? (условно в боте есть кнопка, нажатие на которую приводит тебя к выбору чата и выдаче прав боту)
ηє νєямσяє
5
Карта сайта