新的模板规则很糟糕 [英] New template rules is bad
问题描述
新的C ++规则总是试图快速执行编译 - 编译代码,
必须仅在实例点编译(不在声明期间
阶段)。这种行为引发了许多错误的限制。
看看这个奇怪的限制:
1.无法宣布模板化的朋友
模板< T级>
级X
{
朋友级T;
//错误:使用模板类型参数''上课'后'''''
//错误:朋友声明没有命名类或功能
};
-
Maksim A Polyanin
New C++ rules are always trying to do "fast" compilation - to compile code,
which must be compiled at point of instance only (not during declaration
stage). The behaviour is intoducing many wrong limitations.
Look at this strange limitation:
1. Can not declare templated friend
template< class T>
class X
{
friend class T;
//error: using template type parameter ''T'' after ''class''
//error: friend declaration does not name a class or function
};
--
Maksim A Polyanin
推荐答案
Grizlyk写道:
Grizlyk wrote:
新的C ++规则总是试图快速执行编译 - 编译
代码,必须仅在实例点编译(不在
声明阶段)。这个行为引起了许多错误的
限制。
看看这个奇怪的限制:
1.无法声明模板化的朋友
模板< T级>
级X
{
朋友级T;
//错误:使用模板类型参数''上课'后'''''
//错误:朋友声明没有命名类或函数
};
New C++ rules are always trying to do "fast" compilation - to compile
code, which must be compiled at point of instance only (not during
declaration stage). The behaviour is intoducing many wrong
limitations.
Look at this strange limitation:
1. Can not declare templated friend
template< class T>
class X
{
friend class T;
//error: using template type parameter ''T'' after ''class''
//error: friend declaration does not name a class or function
};
友谊被高估了。
V
-
请在通过电子邮件回复时删除资金''A'
我没有回复最热门的回复,请不要问
Friendship is overrated.
V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask
1月30日下午5:53,Grizlyk < grizl ... @ yandex.ruwrote:
On Jan 30, 5:53 pm, "Grizlyk" <grizl...@yandex.ruwrote:
新的C ++规则总是试图快速执行编译 - 编译代码,
必须仅在实例点编译(不在声明期间
阶段)。这种行为引发了许多错误的限制。
看看这个奇怪的限制:
1.无法宣布模板化的朋友
模板< T级>
级X
{
朋友级T;
//错误:使用模板类型参数''上课'后'''''
//错误:朋友声明没有命名类或功能
};
New C++ rules are always trying to do "fast" compilation - to compile code,
which must be compiled at point of instance only (not during declaration
stage). The behaviour is intoducing many wrong limitations.
Look at this strange limitation:
1. Can not declare templated friend
template< class T>
class X
{
friend class T;
//error: using template type parameter ''T'' after ''class''
//error: friend declaration does not name a class or function
};
为什么要称这些为新字样?模板规则?据我所知,这个
一直是十年前标准被采用的标准行为。
致以最好的问候,
Tom
Why do you call these "new" template rules? As far as I know, this
has been the standard behavior since the standard was adopted almost
ten years ago.
Best regards,
Tom
Victor Bazarov写道:
Victor Bazarov wrote:
友谊被高估了。
Friendship is overrated.
哦,是吗?尝试从你的敌人那里榨取啤酒!
:-)
Oh yeah? Try bumming a beer from your enemies!
:-)
这篇关于新的模板规则很糟糕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!