Closed bllanos closed 2 months ago
On your note: No, I'm not aware of any case where we use the singleton being initialized and destroyed multiple times. (Isn't this a bit against what a singleton is - in theory?).
Arg, yes the contribution docs. We've started rewriting them and extending them over here but yeah. There is room for improvement.
Fixes #1041
std::call_once
to initialize and destroy singleton classes.Notes
I added an assertion to the
ExitInstance()
function to help users detect if they call it multiple times in the same program by accident. Correct me if I am mistaken, but I assumed singleton classes do not need to be initialized and shutdown more than once. The previous version of the code allowed for multiple cycles of initialization and shutdown.Other
The CONTRIBUTING.md file mentions
format-check.sh
that I don't see in the repository, and it also links to a different location for the repository,https://github.com/whoshuu/cpr
.