3 ms·
How about, in C++, doing: template <class T> using shared_immutable = std::shared_ptr<const T>; template <class T> using isolated = std::unique_ptr<T>; That'
by pierrebai 6y ago
How about, in C++, doing:
template <class T>
using shared_immutable = std::shared_ptr<const T>;
template <class T>
using isolated = std::unique_ptr<T>;
That's basically how you'd guarantee that shared data is immutable and data passed along is held by only one thread.
Sure, sure, if you try, you can explicitly take out raw pointers out of them. You can also take an axe to your computer but, as they say, "just don't do that".