Disable implicit conversion from Result<T> to optional<T>.
GitOrigin-RevId: bb064610012c5b650c2517cf4908a9514bc6a7e3
This commit is contained in:
parent
813ba873a8
commit
abe3ff55b0
@ -17,7 +17,9 @@ template <class T>
|
|||||||
class optional {
|
class optional {
|
||||||
public:
|
public:
|
||||||
optional() = default;
|
optional() = default;
|
||||||
template <class T1, std::enable_if_t<!std::is_same<std::decay_t<T1>, optional>::value, int> = 0>
|
template <class T1,
|
||||||
|
std::enable_if_t<!std::is_same<std::decay_t<T1>, optional>::value && std::is_constructible<T, T1>::value,
|
||||||
|
int> = 0>
|
||||||
optional(T1 &&t) : impl_(std::forward<T1>(t)) {
|
optional(T1 &&t) : impl_(std::forward<T1>(t)) {
|
||||||
}
|
}
|
||||||
explicit operator bool() const {
|
explicit operator bool() const {
|
||||||
|
Reference in New Issue
Block a user