#pragma once template TOUT* FindNextPointerType(TIN* typeIn, XrStructureType structureType) { auto* baseStruct = reinterpret_cast(typeIn); // Loop over the next pointers and look for structureType while ((baseStruct = static_cast(baseStruct->next)) != nullptr && baseStruct->type != structureType) { } // If we found it, cast to out type. If not we'll return nullptr. return reinterpret_cast(baseStruct); } template const TOUT* FindNextPointerType(const TIN* typeIn, XrStructureType structureType) { auto* baseStruct = reinterpret_cast(typeIn); // Loop over the next pointers and look for structureType while ((baseStruct = static_cast(baseStruct->next)) != nullptr && baseStruct->type != structureType) { } // If we found it, cast to out type. If not we'll return nullptr. return reinterpret_cast(baseStruct); }