Double closing angle brackets (>>) generate syntax error in SPECIFIC case

前端 未结 2 450
半阙折子戏
半阙折子戏 2020-12-11 07:34

Eclipse (Luna, 4.4.2) tells me that I have a syntax error on the following line:

static_cast>(a.mul(b));

I rememb

2条回答
  •  再見小時候
    2020-12-11 08:24

    You have used a pre c++11 standard compiler. The older standard had a problem letting the parser disambiguate a pair of closing angle brackets >> used in a nested template type specifier, from the operator>>(). Thus you had to write a space between them.

    The samples like >>> or >>* are falling under a different case for the old parsers, thus they work without error message.


    I have to admit, I don't actually know what exactly was done in the c++11 (the current) standards definitions, that this situation can be clearly disambiguated by a c++11 compliant parser.

提交回复
热议问题