cxx_dynamic_array_traits.hpp 461 B

12345678910111213141516171819202122
  1. #pragma once
  2. namespace nkg::resource_traits {
  3. template<typename element_t>
  4. struct cxx_dynamic_array_traits {
  5. using handle_t = element_t*;
  6. static constexpr handle_t invalid_value = nullptr;
  7. [[nodiscard]]
  8. static bool is_valid(const handle_t& handle) noexcept {
  9. return handle != invalid_value;
  10. }
  11. static void release(const handle_t& handle) {
  12. delete[] handle;
  13. }
  14. };
  15. }