When attempting to access a tuple's value via a scoped and typed enum, I get an error saying there is no matching type for std::get
.
enum class User: std::size_t {
FirstName = 1,
LastName = 2,
};
std::tuple<std::string, std::string> user("Bobby", "Bean");
// Error
std::cout << std::get<User::FirstName>(user) << std::endl;
Given that std::get
expects type std::size_t
and the underlying type of the enum is also std::size_t
, why does this fail?
I'm aware that I can cast the value of the enum, but I'm not sure why that would be necessary given that both underlying types are the same. With an unscoped enum, this works just fine.