Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| llvm/include/llvm/ADT/DenseMapInfo.h | ||
|---|---|---|
| 354–356 | I think we may be able to use std::visit twice and rely on the type of the parameter in the second visit matching the original type of the value we cast to const void *. const void *ErasedLHSValue = std::visit([](const auto& LHSValue){
return static_cast<const void *>(&LHSValue);
}, l);
return std::visit([=](const auto& RHSValue){
using T = std::remove_reference_t<decltype(RHSValue)>;
return DenseMapInfo<T>::isEqual(*static_cast<T *>(ErasedLHSValue), RHSValue);
}, r); | |
| llvm/include/llvm/ADT/DenseMapInfo.h | ||
|---|---|---|
| 354–356 | Right! I always forget that auto-params in lambdas are good for something other than saving typing :-) | |
I think we may be able to use std::visit twice and rely on the type of the parameter in the second visit matching the original type of the value we cast to const void *.
const void *ErasedLHSValue = std::visit([](const auto& LHSValue){ return static_cast<const void *>(&LHSValue); }, l); return std::visit([=](const auto& RHSValue){ using T = std::remove_reference_t<decltype(RHSValue)>; return DenseMapInfo<T>::isEqual(*static_cast<T *>(ErasedLHSValue), RHSValue); }, r);