std::optional specialization for reference types

后端 未结 5 2114
时光取名叫无心
时光取名叫无心 2020-12-06 09:34

Why std::optional (std::experimental::optional in libc++ at the moment) does not have specialization for reference types (compared

5条回答
  •  醉梦人生
    2020-12-06 10:02

    If I would hazard a guess, it would be because of this sentence in the specification of std::experimental::optional. (Section 5.2, p1)

    A program that necessitates the instantiation of template optional for a reference type, or for possibly cv-qualified types in_place_t or nullopt_t is ill-formed.

提交回复
热议问题