Thread Links | Date Links | ||||
---|---|---|---|---|---|
Thread Prev | Thread Next | Thread Index | Date Prev | Date Next | Date Index |
Vincent asked: In C++ 11, can you write literals of the form [123]_xx ?
Unfortunately no, it's not that flexible. The [ would be treated as an opening subscript operator and depending on context that would either be an error or not do what you want for a interval literal. In the right context the ]_xx would be treated as a closing subscript operator followed by a symbolic name _xx.
It's possible some future C++ standard could allow this, but not C++ 11.
What would work is to put the bracketed part of the literal in quotes, like "[123]"_xx, where the suffix _xx has been defined to produce an interval from a string. Handlers for multiple suffixes can produce values of the same type, and each handler could include whatever decoration that suffix implied.
- Ian McIntosh IBM Canada Lab Compiler Back End Support and Development