Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My stance is just based on cpp core guidelines:

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines...

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 (about 3:30 in)



That link says nothing about std::reference_wrapper ?


I’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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: