15

When reading about const_cast I came across sentences like the following:

Only the following conversions can be done with const_cast. In particular, only const_cast may be used to cast away (remove) constness or volatility.

1) Two possibly multilevel pointers to the same type may be converted between each other, regardless of cv-qualifiers at each level.

I've googled around a bit already and haven't found any concise, straightforward definitions of what a multilevel pointer is. So: what exactly is a multilevel pointer?

(Possible face-palm moment) It it just a pointer to a pointer, or pointer to a pointer to a pointer, e.g. int ** or int ***?

Claudiu
  • 224,032
  • 165
  • 485
  • 680
  • 1
    Yes a multilevel pointer is something like `T**` or `T***` or even `T********` – Sebastian Hoffmann Mar 10 '14 at 18:24
  • 1
    The draft standard does not explicitly define it but it does give you enough information to figure out in section `4.4 Qualification conversions`. Seems like they assume it is common knowledge. – Shafik Yaghmour Mar 10 '14 at 18:50

1 Answers1

16

Is it just a pointer to a pointer, or pointer to a pointer to a pointer, e.g. int ** or int ***?

It is exactly this, yes.

TypeIA
  • 16,916
  • 1
  • 38
  • 52