4 ms·
reference wrapper breaks in generic contexts.
by beached_whale 6y ago
reference wrapper breaks in generic contexts.
- CyberRabbi 6y agoCould you provide an example?
- clappski 6y agoYou 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.
- beached_whale 6y agoalso if you are doing something like decltype( *val ) to get at the underlying type.