News for hackers. Stuff that matters.
Re:Ask HN: Good C++ code bases to read? by beached_whale on Wednesday October 28, 2020 @10:17PM (#24926378)
reference wrapper breaks in generic contexts.
Re:Ask HN: Good C++ code bases to read? by CyberRabbi on Wednesday October 28, 2020 @10:31PM (#24926458)
Could you provide an example?
Re:Ask HN: Good C++ code bases to read? by clappski on Thursday October 29, 2020 @06:55AM (#24929134)
You have to add special handling for the case that T == std::reference_wrapper<T> so you can call .get() on it to expose the underlying value. In the case of std::optional vs a pointer type (raw or smart) you can consistently use operator* to get to the underlying value. I think this is what was meant.
Re:Ask HN: Good C++ code bases to read? by beached_whale on Thursday October 29, 2020 @02:03PM (#24933260)
also if you are doing something like decltype( *val ) to get at the underlying type.