This looks interesting
Last edited on
Well, the entry is not overly promising:
1 2 3 4 5 6 7 8 9
|
static unique_ptr<ICompressionMethod> Create(const string& fileName) {
auto extension = GetExtension(filename);
if (extension == "zip")
return make_unique<ZipCompression>();
else if (extension = "bz")
return make_unique<BZCompression>();
return nullptr;
}
|
|
You can solve that addressed without C++20 using std::map:
1 2 3 4 5
|
static std::map<string_view, TCreateMethod>& get_map()
{
static std::map<string_view, TCreateMethod> s_methods;
return s_methods;
}
|
Topic archived. No new replies allowed.