Declaring a reference to a C ++ constant

how can the following expression be expressed with the constant first (without typedef)?

double* const (&data)[6]
// ?? const double* (&data)[6] // incorrect, elements, not reference, are const

Thank you

+3
source share
1 answer

You cannot do this.

In accordance with C ++ 8.3.2 / 1 standard:

Cv-qualified links are poorly formed, except when cv-qualifiers are introduced using typedef (7.1.3) or the template type argument (14.3), in which case cv-qualifiers are ignored.

+1
source

Source: https://habr.com/ru/post/1761233/


All Articles