diff --git a/object.cpp b/object.cpp index e9b219e..abc015a 100644 --- a/object.cpp +++ b/object.cpp @@ -77,13 +77,16 @@ VK_INSTANTIATED_TYPE_MAP (INSTANTIATED) template std::vector cruft::vk::enumerated::find (const instance &inst) { + // find the total number of objects uint32_t expected = 0; error::try_code (enum_traits::enumerate (inst.id (), &expected, nullptr)); + // allocate an array of handles and fetch them uint32_t found = expected; typename T::id_t handles[expected]; error::try_code (enum_traits::enumerate (inst.id (), &found, handles)); + // return an collection of objects from the handles return std::vector (handles, handles + found); }