Its a call to alternative tokens. There are several of them in C ++:
<% { %> } <: [ :> ] %: # %:%: ## and && bitor | or || xor ห compl ~ bitand & and_eq &= or_eq |= xor_eq ห= not ! not_eq !=
You can see that some alternative markers are made up of letters. Therefore, you can write if (a<b and b<c)
in the compiler, which can correctly handle them. Their existence is due to the lack of characters in keyboards or character sets. Alternative tokens are never replaced by primary tokens (as opposed to trigraphs), but they behave in the same way as the primary one.
However, C ++ 0x requires special handling for <::
(2.5p3):
Otherwise, if the following three characters: <:: and the subsequent character is neither: nor>, <is treated as the preprocessor token by itself, and not as the first character of the alternative token <:.
So SomeTemplate<::SomeClass>
can be processed correctly.
source share