This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Any variant class?
- From: Ed Smith-Rowland <3dw4rd at verizon dot net>
- To: Tim Shen <timshen at google dot com>, libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 24 Feb 2015 02:56:12 -0500
- Subject: Re: Any variant class?
- Authentication-results: sourceware.org; auth=none
- References: <CAG4ZjNmsk+Ak02oKmzw4FaLfhsBc_GhuPe4cy+DU6pvTLYoVhw at mail dot gmail dot com>
On 02/24/2015 01:55 AM, Tim Shen wrote:
Hi there,
I'm recently refactoring <regex>, and one of the problem needs to be
solved is stack overflow due to deep recursion.
I plan to solve this by using a heap allocated stack. Ideally it will
be `std::stack<_Variant<...>>` or `std::unique_ptr<_Variant<...>[]>`.
I don't think we have an existing variant class that can be used?
If there's no, I'm gonna write one. Is there any benefit of making a
boost::variant-ish one, or otherwise I can design my own interface?
Thanks!
There may be papers on this.
Here's one -
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4218.pdf.
I guess my feeling is if one may be coming down the line we could start
work on it.
Obviously, it would need to work in C++11.
What types do you expect to be in your variant? I admit I haven't
studied the regex code.
Ed