Skip to content
Discussion options

You must be logged in to vote

@FishAI, can you try something like this?

auto ptr = std::make_unique<Derived1>();
using namespace matchit;
// match ptr or ptr.get() ? currently only *ptr works?
match (ptr) (
 pattern | some(as<Derived1>(_)) = []{ std::cout << "Derived 1"; },
 pattern | some(as<Derived2>(_)) = []{ std::cout << "Derived 2"; },
 pattern | _ = []{});

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by FishAI
Comment options

You must be logged in to vote
1 reply
@BowenFu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants