#include <iostream>
#include <any>
#include <map>
enum class KeyType {
One, Two, Three
};
using ParamsType = std::map<KeyType, std::any>;
void TestFunc(ParamsType param) {
for(const auto &i: param) {
std::cout << "param [";
switch(i.first) {
case KeyType::One: std::cout << "One]: " << std::any_cast<std::string>(i.second); break;
case KeyType::Two: std::cout << "Two]: " << std::any_cast<int>(i.second); break;
case KeyType::Three: std::cout << "Three]: " << std::any_cast<double>(i.second); break;
default: std::cout << "Unknown]";
}
std::cout << std::endl;
}
}
int main() {
TestFunc({
{KeyType::Two, 2},
{KeyType::One, std::string{"Один"}},
// можно пропустить, а можно не пропустить {KeyType::Three, 2.71828}
});
return 0;
}