std ::参考类型的可选专业化 [英] std::optional specialization for reference types
问题描述
为什么std::optional
(目前在 libc ++ 中的std::experimental::optional
)没有对引用类型的专业化(与boost::optional
相比)?
Why std::optional
(std::experimental::optional
in libc++ at the moment) does not have specialization for reference types (compared with boost::optional
)?
我认为这将是非常有用的选择.
I think it would be very useful option.
在 STL 中是否有一些对象引用了也许已经存在的对象语义?
Is there some object with reference to maybe already existing object semantics in STL?
推荐答案
n3527 (修订版3),作者决定将可选引用作为辅助建议,以增加获得批准的可选值并将其放入C ++ 14的机会.尽管出于各种其他原因,可选项并没有完全融入C ++ 14中,但委员会并未拒绝可选项引用,并且在将来有人建议时可以随意添加可选项引用.
When n3406 (revision #2 of the proposal) was discussed, some committee members were uncomfortable with optional references. In n3527 (revision #3), the authors decided to make optional references an auxiliary proposal, to increase the chances of getting optional values approved and put into what became C++14. While optional didn't quite make it into C++14 for various other reasons, the committee did not reject optional references and is free to add optional references in the future should someone propose it.
这篇关于std ::参考类型的可选专业化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!