Singleton.cpp 575 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #include <AnKi/Util/Singleton.h>
  6. namespace anki {
  7. #if ANKI_ASSERTIONS_ENABLED
  8. I32 g_singletonsAllocated = 0;
  9. class SingletonsAllocatedChecker
  10. {
  11. public:
  12. SingletonsAllocatedChecker()
  13. {
  14. g_singletonsAllocated = 0;
  15. }
  16. ~SingletonsAllocatedChecker()
  17. {
  18. ANKI_ASSERT(g_singletonsAllocated == 0);
  19. }
  20. };
  21. SingletonsAllocatedChecker g_singletonsAllocatedChecker;
  22. #endif
  23. } // end namespace anki