37 template <
typename T> std::vector<const char*>
getExtensions(
const std::vector<T>& availableExtensions,
38 const std::vector<std::string>& requiredExtensions,
const std::vector<std::string>& requestedExtensions,
39 std::function<std::string (
const T&)> mappingFn) {
42 std::vector<const char*> extensions;
45 for (
const std::string& requiredExtension : requiredExtensions) {
48 if (std::find_if(availableExtensions.begin(), availableExtensions.end(), [&](
const T& availableExtension) {
49 return requiredExtension == mappingFn(availableExtension);
50 }) == availableExtensions.end())
51 throw std::runtime_error(
"Unable to find required extension - " + requiredExtension);
54 extensions.push_back(requiredExtension.c_str());
58 for (
const std::string& requestedExtension : requestedExtensions) {
61 if (std::find_if(availableExtensions.begin(), availableExtensions.end(), [&](
const T& availableExtension) {
62 return requestedExtension == mappingFn(availableExtension);
63 }) == availableExtensions.end())
67 extensions.push_back(requestedExtension.c_str());
std::vector< const char * > getExtensions(const std::vector< T > &availableExtensions, const std::vector< std::string > &requiredExtensions, const std::vector< std::string > &requestedExtensions, std::function< std::string(const T &)> mappingFn)