This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Any variant class?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]