Boost logo

Boost Users :

Subject: [Boost-users] [boost.variant] accessing variant with pattern-matching instead of visitors
From: Roger (perrog_at_[hidden])
Date: 2014-11-01 23:22:07


Hi!

The CppCon 2014, Yuriy Solodkyy had an interesting talk "Accept no
visitors"(*). It presents an alternative accessing technique for
variant data-type. It basically use pattern matching syntax, similar
to that in functional languages, instead of visitors.

I think this would be a great benefit for boost::variant data-type...
being able to access variables from the same scope, group states
similar in behavior, and take care of the loop unrolling for
dispatching oneself. Especially when using variant as polymorphism,
like the other interesting CppCon 2014 talking, Jason Lucas
"Polymorphism with Unions" (**) covered.

Would it be worth to implement a tiny pattern-matching library for
boost::variant itself? Has anyone elaborated with this?

Thanks for any hints!
/perrog

* Yuriy Solodkyy "Accept no visitors, http://youtu.be/QhJguzpZOrk
** Jason Lucas "Polymorphism with Unions", http://youtu.be/uii2AfiMA0o


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net