Make optional_reference bool conversion explicit

If this is non-explicit, then the following code:

optional_reference<config> ref = ...;
auto str = ref["key"]

results in ref being converted to bool and used as an index into the key string.
This commit is contained in:
Celtic Minstrel 2021-08-02 00:41:31 -04:00 committed by Celtic Minstrel
parent a9906226a7
commit b1b79bfd14

View file

@ -70,7 +70,7 @@ public:
return *this;
}
operator bool() const
explicit operator bool() const
{
return opt_.has_value();
}