How to get supported extensions in Vulkan

The vkEnumerateInstanceExtensionProperties API does this.

std::set<std::string> get_supported_extensions() {
    uint32_t count;
    vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr); //get number of extensions
    std::vector<VkExtensionProperties> extensions(count);
    vkEnumerateInstanceExtensionProperties(nullptr, &count, extensions.data()); //populate buffer
    std::set<std::string> results;
    for (auto & extension : extensions) {
        results.insert(extension.extensionName);
    }
    return results;
}