Should I make RefCounted and data structures that use it configurable, such that they're not atomic by default, but can be trivially made atomic? The use of non-atomic ref counting makes it impossible to store ref counted data structures in classes for now, and makes it impossible to share them across threads forever, even if you synchronize manually. In cases where they are not being passed around much, I don't think atomic reference counting is unreasonably expensive. I personally would love a version of std.container.Array with a few issues I've mentioned previously fixed and with atomic ref counting.<br>
<br>If people like the idea of making this configurable, any input on how? I see three ways:<br><br>1. Make RefCounted into a class instead of a struct, and use virtual functions and interfaces. (Probably a bad idea, but I'll throw it out there anyhow).<br>
<br>2. Store a bool in it and use an if statement. (I like this. It allows runtime flexibility and the perf. cost should be negligible because the branch will be so predictable.)<br><br>3. Use a template parameter and handle it at compile time. (I don't like the idea of atomic and non-atomic ref counted versions of the same container being different types. OTOH, this is the most efficient at runtime.)<br>