Create a new type when using std::variant -- Zhihao Yuan

Enough typedefs.

Create a new type when using std::variant

by Zhihao Yuan

From the article:

class rock {};
class paper {};
class scissors {};
using hand = std::variant<rock, paper, scissors>;

Ignoring the fact that this hand type comes with heavily overloaded constructors and you can only add free functions, a troublesome issue is that the type-name std::variant<rock, paper, scissors> will appear everywhere in debuggers and linkers in place of hand.

Add a Comment

You must sign in or register to add a comment.

Comments (0)

There are currently no comments on this entry.