Re: Upgrading C++ library features.

From: Zaphod Beeblebrox <zbeeble_at_gmail.com>
Date: Thu, 24 Sep 2026 20:25:54 UTC
Yes, the complaint is about enumerate not being in the views namespace.
Same as your error.

... So I'm reading that there is no known way to grab a newer set of libc++
and associated header files.  15.1 is clang 19, it seems.  Is 16 planning
to ship with clang21, or might it ship with clang23?

On Thu, Sep 24, 2026 at 3:48 PM Mark Millard <marklmi@yahoo.com> wrote:

> On 9/24/26 09:46, Zaphod Beeblebrox wrote:
> > I'm currently running FreeBSD 15.1.  I found out that in c++20 you can
> > now say:
> >
> > for(auto [i, j] : v | std::views:enumerate)
> >
> > ... which I would very much like to.  FreeBSD 15.1 has clang 19 as
> > standard, which supposedly support c++20 and more, but some searching
> > leads me to conclude that enumerate is a late addition to clang.
> >
> > So I installed clang23 to see.  This still kicks out the error --- but
> > I'm expecting this is about include files.  Does clang23 come with new
> > include files --- or can I access them.  I suppose there is a similar
> > question about libc++ ... even though this specific problem doesn't
> > involve the library proper, AFAIK.
> >
> > Help?
>
> For the most part, libc++ is include files. Something like
> std::views:enumerate would be from the libc++ headers.
>
> The FreeBSD OS supports only its own libc++ header files, no matter
> which LLVM or clang++ compiler version is in use. That includes if one
> uses a devel/llvm* port (or package).
>
> The LLVM development is not linear in C++ standard versions. There are
> still things missing that are defined in c++17 (so somewhat under a
> decade ago). There are other things from much more recent standard
> versions that are implemented. One has to track status item by item,
> rather than a C++ standard version as a a unit. (Some things have
> "nothing to do" because they were implemented before the standard for
> whatever the issue was.)
>
> You do not give the actual error message(s). Some of the notation in:
>
> for(auto [i, j] : v | std::views:enumerate)
>
> is not from libc++ and other parts of it are. There is no clue given
> about which parts ended up being referenced as wrong/unsupported by the
> error message(s).
>
> For:
>
> #include <iostream>
> #include <vector>
> #include <ranges>
> #include <tuple>
>
> int main() {
>     std::vector<std::tuple<int,uint>> t = {};
>     std::vector<int>             v = {};
>
>     for (auto [i, j] : t) {
>         std::cout << "Index: " << i << ", Value: " << j << "\n";
>     }
>
>     for (auto [i, j] : std::views::enumerate(v)) {
>         std::cout << "Index: " << i << ", Value: " << j << "\n";
>     }
>
>     for (auto [i, j] : v | std::views::enumerate) {
>         std::cout << "Index: " << i << ", Value: " << j << "\n";
>     }
>
>     return 0;
> }
>
>
> On a main (a.k.a. CURRENT) FreeBSD OS I get:
>
> # c++ -std=c++23 c23_structured_binding_example.cc
> c23_structured_binding_example.cc:14:36: error: no member named
> 'enumerate' in namespace 'std::ranges::views'
>    14 |     for (auto [i, j] : std::views::enumerate(v)) {
>       |                                    ^~~~~~~~~
> c23_structured_binding_example.cc:18:40: error: no member named
> 'enumerate' in namespace 'std::ranges::views'
>    18 |     for (auto [i, j] : v | std::views::enumerate) {
>       |                                        ^~~~~~~~~
> 2 errors generated.
>
> # c++ -std=c++23 -fexperimental-library \
> c23_structured_binding_example.cc
> c23_structured_binding_example.cc:14:36: error: no member named
> 'enumerate' in namespace 'std::ranges::views'
>    14 |     for (auto [i, j] : std::views::enumerate(v)) {
>       |                                    ^~~~~~~~~
> c23_structured_binding_example.cc:18:40: error: no member named
> 'enumerate' in namespace 'std::ranges::views'
>    18 |     for (auto [i, j] : v | std::views::enumerate) {
>       |                                        ^~~~~~~~~
> 2 errors generated.
>
>
> Those are complaints about something missing in the libc++ headers. Note
> that the first "for(. . .)" got no complaints at all. Nor were there any
> complaints about std::views of itself.
>
>
> For Reference:
>
> # c++ -v
> FreeBSD clang version 21.1.8 (https://github.com/llvm/llvm-project.git
> llvmorg-21.1.8-0-g2078da43e25a
> <https://github.com/llvm/llvm-project.gitllvmorg-21.1.8-0-g2078da43e25a>)
> Target: aarch64-unknown-freebsd16.0
> Thread model: posix
> InstalledDir: /usr/bin
>
> https://libcxx.llvm.org/Status/Cxx23.html#cxx23-status reports:
>
> P2164R9 views::enumerate 2023-02 (Issaquah) Complete 23 #105251
>
> That 23 is for LLVM23 and its libc++23 being the "First released
> version". Some things are incompletely implemented well before they are
> fully implemented/released. -fexperimental-library sometimes allows use
> of some incompletely implemented status items.
>
> Until the FreeBSD OS version of interest is based o LLVM23 and its
> libc++23 (or later versions of such), std::views::enumerate will not be
> operational as far as I can tell.
>
>
> --
> ===
> Mark Millard
> marklmi at yahoo.com
>