问题描述
众所周知,由于C ++的最长匹配而规则,>>令牌原因
使用嵌套模板时头疼,例如
vector< vector< int>>
如果没有在两个>
标志之间插入空格,将无法正确解析。为什么有>>令牌?为什么不拥有>是令牌,并且
句柄>>在语法中作为两个>令牌?
这将允许代码如3> > 1,但这对我来说似乎无害。
As we know, due to C++''s "longest match" rule, the >> token causes
headaches when working with nested templates, e.g.
vector<vector<int>>
will not parse correctly without inserting a space between the two >
signs. Why have a >> token at all? Why not have > be the token, and
handle >> in the grammar as two > tokens?
This would permit code like 3 > > 1, but that seems harmless to me.
推荐答案
嗯,那你用什么大于?如果它超载,那么你将获得上下文敏感性问题,这会让语法更加难以处理......
Hmmm, then what would you use for "greater than"? If it''s "overloaded", you
then end up with context sensitivity issues, which makes grammars much
harder to deal with...
这会使语法比现在复杂得多。这不是值得的b $ b。
-
祝你好运,
Andrey Tarasevich
That would make the grammar much more complex than it is now. It is not
worth it.
--
Best regards,
Andrey Tarasevich
嗯,那你用什么大于?如果它被重载,那么你最终会遇到上下文敏感问题,这会使语法更难处理......
Hmmm, then what would you use for "greater than"? If it''s
"overloaded", you then end up with context sensitivity issues, which
makes grammars much harder to deal with...
已经存在上下文敏感问题。这就是为什么你不能写b $ b不能写矢量< vector< int>>。 更大的令牌已经是
重载。
There are already context sensitivity issues. That''s the reason why you
can''t write vector<vector<int>>. The "greater" token already is
"overloaded".
这篇关于>>代币的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!