object: briefly comment the enumerate method

This commit is contained in:
Danny Robson 2017-09-01 13:12:11 +10:00
parent b2702d994d
commit 0a84a4ebb3

View File

@ -77,13 +77,16 @@ VK_INSTANTIATED_TYPE_MAP (INSTANTIATED)
template <typename T>
std::vector<T>
cruft::vk::enumerated<T>::find (const instance &inst) {
// find the total number of objects
uint32_t expected = 0;
error::try_code (enum_traits<T>::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<T>::enumerate (inst.id (), &found, handles));
// return an collection of objects from the handles
return std::vector<T> (handles, handles + found);
}