On Mon, Apr 29, 2019 at 4:55 PM Nikita Kniazev
Would your problems also be solved if there were a separate type, different from recursive_wrapper, that is similar but explicitly has an empty state
This can be done, but it leaves recursive_wrapper in the broken state for move only types and increases complexity of the variant.
Calling "recursive_wrapper" broken is a matter of debate, and I suspect you're in the minority for that specific argument. For many, recursive_wrapper itself is, on its own, okay. The less-controversial statement is that there is no simple way to get the semantics that you want, with the performance that you want. I suspect that the answer may be closer to either a template that is different, but similar to recursive_wrapper, or alternatively, a template that is similar but different from a never-empty variant. -- -Matt Calabrese