[all-commits] [llvm/llvm-project] 86df5a: [libc++] Simplify std::ranges::subrange

Louis Dionne via All-commits all-commits at lists.llvm.org
Tue Sep 28 14:34:15 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 86df5a2fa832cdb42928c7a6670eb927f04b98d4
      https://github.com/llvm/llvm-project/commit/86df5a2fa832cdb42928c7a6670eb927f04b98d4
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    M libcxx/include/__ranges/subrange.h
    A libcxx/test/std/ranges/range.utility/range.subrange/ctor.default.pass.cpp

  Log Message:
  -----------
  [libc++] Simplify std::ranges::subrange

Instead of using a base class to store the members and the optional
size, use [[no_unique_address]] to achieve the same thing without
needing a base class.

Also, as a fly-by:
- Change subrange from struct to class (per the standard)
- Improve the diagnostic for when one doesn't provide a size to the ctor of a sized subrange
- Replace this->member by just member since it's not in a dependent base anymore

This change would be an ABI break due to [[no_unique_address]], but we
haven't shipped ranges anywhere yet, so this shouldn't affect anyone.

Differential Revision: https://reviews.llvm.org/D110370




More information about the All-commits mailing list