[all-commits] [llvm/llvm-project] 0556a2: [ArrayRef] Provide constructors from any type with...

Benjamin Kramer via All-commits all-commits at lists.llvm.org
Wed Jun 25 10:33:55 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0556a2aa187b86c28a9441aec3e98b9780a2c9ee
      https://github.com/llvm/llvm-project/commit/0556a2aa187b86c28a9441aec3e98b9780a2c9ee
  Author: Benjamin Kramer <benny.kra at googlemail.com>
  Date:   2025-06-25 (Wed, 25 Jun 2025)

  Changed paths:
    M llvm/include/llvm/ADT/ArrayRef.h
    M llvm/unittests/ADT/ArrayRefTest.cpp

  Log Message:
  -----------
  [ArrayRef] Provide constructors from any type with a data() member (#145735)

The assumption here is that if data() returns a pointer and size()
exists it's something representing contiguous storage.

Modeled after the behavior of C++20 std::span and enables two-way
conversion between std::span (or really any span-like type) and
ArrayRef. Add a unit test that verifies this if std::span is around.

This also means we can get rid of specific conversions for std::vector
and SmallVector.



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