mutable const


At work we wanted to make a referenced counted object that didn’t do any heap allocations. We made a doubly linked list implementation. We got to write a declaration that looks something like this.

class Node {
   mutable const Node * next;
   mutable const Node * prev;

You gotta love const-correctness.



Russell O’Connor: contact me