[libcxx-dev] Providing custom template specialization for std::optional?
Louis Dionne via libcxx-dev
libcxx-dev at lists.llvm.org
Mon Mar 11 08:34:42 PDT 2019
> On Mar 7, 2019, at 00:39, Eric Fiselier via libcxx-dev <libcxx-dev at lists.llvm.org> wrote:
> On Wed, Mar 6, 2019 at 5:41 PM Владимир Гончаров via libcxx-dev <libcxx-dev at lists.llvm.org <mailto:libcxx-dev at lists.llvm.org>> wrote:
> I'm implementing a specialization for std::optional for my program-defined type.
> Can you explain what your specialization does differently? And why it's needed?
> As I understand [namespace.std], nothing forbids me from doing that.
> I agree that you've interpreted the standard correctly. But I think the standard is being too permissive here.
> Implementing a complex component may necessitate knowledge of the internals. `<variant>` is a good example.
> I would like to know what other library maintainers think.
I think it is a bug in the Standard that we don't explicitly state which templates are safe to specialize, and prohibit doing so by default. I would not try to do anything special to support this in libc++ and I would instead fix the Standard.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the libcxx-dev