[all-commits] [llvm/llvm-project] e74be3: [libc++][ranges] LWG3984: ranges::to's recursion b...

Xiaoyang Liu via All-commits all-commits at lists.llvm.org
Fri Apr 26 08:01:08 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e74be35c1abedf87cfaa141284cb730911211ee1
      https://github.com/llvm/llvm-project/commit/e74be35c1abedf87cfaa141284cb730911211ee1
  Author: Xiaoyang Liu <siujoeng.lau at gmail.com>
  Date:   2024-04-26 (Fri, 26 Apr 2024)

  Changed paths:
    M libcxx/docs/Status/Cxx2cIssues.csv
    M libcxx/include/__ranges/to.h
    M libcxx/test/std/ranges/range.utility/range.utility.conv/to.pass.cpp

  Log Message:
  -----------
  [libc++][ranges] LWG3984: ranges::to's recursion branch may be ill-formed (#87964)

This pull request implements LWG3984: ranges::to's recursion branch
may be ill-formed.

In the current implementation, ranges::to's recursion branch pipes the
range into a `views::transform(/* lambda */)`, which is a __range_adaptor_closure
object. In libc++, the pipe operator of __range_adaptor_closure requires a
viewable_range, so the following code won't compile, as the type of lvalue
`r` doesn't model viewable_range:

  #include <ranges>
  #include <vector>
  #include <list>

  int main() {
    std::vector<std::vector<int>> v;
    auto r = std::views::all(std::move(v));
    auto l = std::ranges::to<std::list<std::list<int>>>(r);
  }

Co-authored-by: A. Jiang <de34 at live.cn>



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