5 ms·
My stance is just based on cpp core guidelines: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-constref https://isocpp.github.io/CppCoreGuidel
by nickysielicki 2y ago
My stance is just based on cpp core guidelines:
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-constref https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines...
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-zero https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines...
std::reference_wrapper still can’t save you from yourself, but it’s better than violating the first link and ending up in this limbo that OP is talking about.
See also: https://youtu.be/YxSg_Gzm-VQ https://youtu.be/YxSg_Gzm-VQ (about 3:30 in)
- lenkite 2y agoThat link says nothing about std::reference_wrapper ?
- nickysielicki 2y agoI’m just saying, nothing up my sleeve, no arcane templatelord bullshit, this is isocpp: don’t use references in your structs because it’s subtly broken. It doesn’t mention reference wrappers but that’s the escape hatch.