3 ms·
Indeed. The author writes: > Whenever the idea of an optional reference comes up, inevitably somebody will bring up the point that we don’t need to support opt
by twic 5y ago
Indeed. The author writes:
> Whenever the idea of an optional reference comes up, inevitably somebody will bring up the point that we don’t need to support optional<T&> because we already have in the language a perfectly good optional reference: T*.
But i have never heard this said even once. Rather, inevitably someone will bring up the point that you can do it with reference_wrapper. Check it out:
https://en.cppreference.com/w/cpp/utility/functional/reference_wrapper#Example https://en.cppreference.com/w/cpp/utility/functional/referen...