Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: "Performance of C++20's Ranges"
Date: Fri, 29 Apr 2022 16:28:59 -0700
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <86zgk34gg4.fsf@linuxsc.com>
References:
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="947a81ba8a661bedfa1d3062f5b6bffa"; logging-data="4765"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+smFuK5a6kNRW1EtsmwDD6SeVBzoxKMbY="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:xpgdUVgReeKJHCTGES+pZ1DpolM= sha1:1JrZGz1Zc+q3F9tD9A+lAsvpjj8=
Xref: csiph.com comp.lang.c++:83889
Juha Nieminen writes:
> Alf P. Steinbach wrote:
>
>> The Ranges library adds not just an new huge API but another large
>> domain specific language which results in very brittle code, and
>> huge complexity, that maintenance programmers must deal with.
>
> Ok, let me put it this way:
>
> The ranges library is just that: A library. It's not part of the
> language syntax itself. It's not making C++ "more complicated"
> because it's not changing the C++ language itself. It's simply an
> ancillary auxiliary library.
>
> You treat these new standard libraries as if they made the language
> more complicated and complex because from now forward you will have
> to encounter C++ code that uses this library, meaning you will need
> to know what this library is doing if you want to undrestand that
> code.
>
> What you aren't considering is this: How is that different from
> programs that use third-party libraries? [...]
There are at least four differences between (in particular) ranges
and a third-party library.
One, there are some ranges-induced changes in the non-library
portion of the C++ standard. Perhaps not very many, but some.
Third-party libraries don't do that.
Two, other areas of the library portion of the C++ standard are
affected by having ranges. Third-party libraries don't do that.
Three, ranges are part of C++20, so using C++20 is a necessary
pre-requisite for using ranges. Third-party libraries can be
compatible with, and usable in, earlier versions of C++.
Four, by virtue of being part of C++20, if someone wants to
use ranges then all the rest of C++20 comes along whether
they want it or not. Third-party libraries can be (and
perhaps even often are) independent, so they can be used
(at least in many cases) without having to also take other
language changes (whether in the library or in the language
proper).