Depends on what you mean by "immutable data structure."
If you mean a type in which variables of this type cannot be assigned otherwise, then see the other answers here (removing access to the assignment operator using const or just having a reference or const data element).
If you mean a type in which values of this type cannot be changed, for example. like a Java or C # or Python string, but where variables of this type can still be assigned, it is more complicated. Your best help might be boost::intrusive_ptr for managing internal volatile state. The reason for intrusive_ptr , unlike, for example, shared_ptr is that intrusive_ptr allows more optimizations, one of which is crucial for, for example, "immutable strings", namely, building such a beast from a literal without any dynamic allocation at all.
I am not aware of any general structure for executing the latter type of “immutable data structure” in C ++.
So it seems that you have created a good idea! :-)
source share