DEV Community

Discussion on: Is there a way to have raw-types in (modern) C++?

Collapse
 
baenencalin profile image
Calin Baenen

I thought of a solution. Just create an abstraction in the form of a new struct (TokenValue):

template<typename T=void*, T v=nullptr> struct TokenInfo {
    T value;
    TokenType type;
}

struct Token {
    TokenInfo info;
};
Enter fullscreen mode Exit fullscreen mode
Collapse
 
baenencalin profile image
Calin Baenen

This doesn't work, obviously. I'm a dumbass