On Sun, Sep 27, 2015 at 1:03 PM, David Stone
Andrzej posted another thread about creating a new compact_optional class. The goal of this class is to make it easy to create a new optional type with a special sentinel value. This allows easy customization per instance of an optional value.
This post is about the opposite approach: making it easier to specialize optional to provide special behavior for all instances of a given optional type.
I think this is a great idea; the fact that generic code will get the optimized version automatically is a strength, not a weakness, of this approach. It is critical, though, that the behavior is indeed identical in all respects to the unspecialized version, so that it is a pure optimization. It does seem though that much of the benefit from this comes from standard library integration, which of course won't be available if it is just part of Boost, so it may be hard to get significant user experience in support of standardization.