mercredi 28 décembre 2016

Change the const of an element of a struct

I have a pointer to a:

struct KeyValue {
  K key;
  V value;
}

and I want to return a reference to the same memory location interpreted as a

struct IKeyValue {
  const K key;
  V value;
}

Is there a clean way to do it in C++11?

Aucun commentaire:

Enregistrer un commentaire