C++.Coding.Standards.1918.Rules.Guidelines [Electronic resources]

Herb Sutter, Andrei Alexandrescu

نسخه متنی -صفحه : 521/ 96
نمايش فراداده

Examples

Example: Passing a template instantiation to a macro. Macros barely understand C's parentheses and square brackets well enough to balance them. C++, however, defines a new parenthetical construct, namely the

< and

> used in templates. Macros can't pair those correctly, which means that in a macro invocation

MACRO( Foo<int, double> )

the macro thinks it is being passed two arguments, namely

Foo<int and

double> , when in fact the construct is one C++ entity.