Sun Studio 12 Update 1: C++ User's Guide

9.1 const_cast

The expression const_cast<T>(v) can be used to change the const or volatile qualifiers of pointers or references. (Among new-style casts, only const_cast<> can remove const qualifiers.) T must be a pointer, reference, or pointer-to-member type.

class A
  virtual void f();
  int i;
extern const volatile int* cvip;
extern int* ip;
void use_of_const_cast()
  const A a1;
  const_cast<A&>(a1).f();                // remove const
ip = const_cast<int*> (cvip);    // remove const and volatile