llvm-project
808f5d13 - [ADT] Simplify a constructor of iterator_range (NFC) (#158005)

Commit
95 days ago
[ADT] Simplify a constructor of iterator_range (NFC) (#158005) Without this patch, we determine whether one iterator type can be converted to another in a roundabout way. Specifically, explicitly_convertible uses std::void_t to determine whether the given conversion expression is well formed, yielding std::true_type/std::false_type. Then the boolean value is passed to std::enable_if_t to obtain void again. That is, we are doing a roundtrip from void to a boolean value and back. This patch removes the roundtrip by directly using std::void_t inside the constructor's template parameter list. Now, explicitly_converted_t is very similar to std::is_constructible, but there a couple of corner cases where they evaluate to different values. For now, this patch sticks to the same expression decltype(static_cast<To>(...)) to be safe.
Parents
Loading