containers.cpp 805 B

12345678910111213141516171819202122232425262728
  1. #include <containers.h>
  2. #include <logs/assert.h>
  3. #define PIKA_DECLARE_CONTAINER(x) if (std::strcmp(name, #x ) == 0) \
  4. { \
  5. if (sizeof(x) != memoryArena->containerStructMemory.size) { return nullptr; } \
  6. return new(memoryArena->containerStructMemory.block) x (); \
  7. } \
  8. else
  9. //this should not allocate memory
  10. Container *getContainer(const char *name, pika::memory::MemoryArena *memoryArena)
  11. {
  12. ///vvVVVVVVVVVVVVVVVVVVVVvv
  13. ///errors here? make sure that you inherited corectly from the base class (all overloads are done properly)
  14. /// it is also possible that you used a class that doesn't have a default constructor or something
  15. PIKA_ALL_CONTAINERS()
  16. {
  17. //"invalid container name: "
  18. return nullptr;
  19. }
  20. }
  21. #undef PIKA_DECLARE_CONTAINER