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: Tue, 10 May 2022 07:36:27 -0700 Organization: A noiseless patient Spider Lines: 64 Message-ID: <86ilqd4fpw.fsf@linuxsc.com> References: <86zgk34gg4.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="14a2ae3f27dfeae71155063f7e16a495"; logging-data="32322"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+WHnvULBitu27yj0j+sXyG+PkXvH7ZC8E=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:S01RnM5htQcYkpjKGFtqfG3inHU= sha1:LOr/Ffz8GcblkguE4fC34MCZpWY= Xref: csiph.com comp.lang.c++:84025 Juha Nieminen writes: > Tim Rentsch wrote: > [some snipped context restored] >> Juha Nieminen writes: >> >>> 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. > > Such as? > >> Two, other areas of the library portion of the C++ standard are >> affected by having ranges. Third-party libraries don't do that. > > So what? > >> 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++. > > There are many third-party libraries that require C++11 and won't > work in C++98 code. There are many that require C++17. How is this > different from requiring C++20? > > "Third party libraries can be compatible with" is a null sentence. > It isn't saying anything. Many third-party libraries could perhaps > be compatible with earlier versions of the language, but they > aren't. So what? > >> 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). > > Again: There are many third-party libraries that require C++11 > (and thus "the rest of C++11 comes along whether they want it or > not"). And so on. So what? How is that different? You asked a question. My response is an effort just to provide a simple, factual answer. Nothing more than that.