4 ms·
References being non-nullable is a huge advantage of references. If you need the equivalent of a nullable reference, you can just use std::optional<std::refere
by TheCoelacanth 9y ago
References being non-nullable is a huge advantage of references.
If you need the equivalent of a nullable reference, you can just use std::optional<std::reference_wrapper<T>> instead and make the nullability explicit.
- Retra 9y agoIf we used std and wanted every type to be 50+ chars long to type, sure. Or we could just use a pointer, which just so happens is a nullable reference.