|
Boost : |
Subject: Re: [boost] [gsoc] improving any and variant
From: Franz Fehringer (fehrin_at_[hidden])
Date: 2009-03-30 02:27:53
What happened to dynamic_any btw?
http://www.ddj.com/cpp/184403961
Mathias Gaunard schrieb:
> A few little ideas that could eventually be joined to be a single GSoC
> project:
>
> - Allow visitation for Any. This can actually be generalized to any
> object that exposes a type_info, such as polymorphic objects.
>
> Techniques, including non-portable ones based on name mangling, could
> be experimented to get more efficient dispatch.
>
> - Add SBO to any.
>
> - Improve variant so that the functor doesn't require to expose a
> result_type. The result_type can be automatically deduced by "joining"
> all the possible return types obtained by boost::result_of.
>
> - Allow the easy construction of a visitor from lambda expressions,
> with a syntax like
>
> variant<int, std::string> a = "foo";
>
> int b = match(a).with(
> args<int>(_1),
> args<std::string>(size(_1))
> );
>
> instead of the potentially more verbose
>
> struct my_visitor : static_visitor<int>
> {
> int operator()(int a) { return a; }
> int operator()(const std::string& b) { return b.size(); }
> };
>
> variant<int, std::string> a = "foo";;
>
> int b = apply_visitor(my_visitor(), a);
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk