This is C++17 syntax. As this standard is not yet the default option for most compilers you have to tell the compiler that you are using it via the -std=c++17
switch.
PS: you didn’t say which compiler you are using, so maybe it will not support that switch or not even support C++17 at all.
solved Const Auto/Identifier Errors [closed]