Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parentheses and unpacking variadic template parameters [duplicate]

Tags:

c++

For example, is

(const int)* someInt;

valid code?

If so, is that statement different than

const int* someInt;

?

like image 285
user383352 Avatar asked Nov 25 '22 19:11

user383352


1 Answers

You can put arbitrarily many parentheses around expressions without changing the meaning. But you cannot do the same with types. In particular, as the others have pointed out, the parenthese in your code change the meaning from a declaration to a cast.

like image 153
Konrad Rudolph Avatar answered May 22 '23 06:05

Konrad Rudolph