[all-commits] [llvm/llvm-project] 808f5d: [ADT] Simplify a constructor of iterator_range (NF...

Kazu Hirata via All-commits all-commits at lists.llvm.org
Thu Sep 11 07:54:41 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 808f5d13b32c4280d186880a676f6be6b02b8fda
      https://github.com/llvm/llvm-project/commit/808f5d13b32c4280d186880a676f6be6b02b8fda
  Author: Kazu Hirata <kazu at google.com>
  Date:   2025-09-11 (Thu, 11 Sep 2025)

  Changed paths:
    M llvm/include/llvm/ADT/iterator_range.h

  Log Message:
  -----------
  [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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list