C++ Logo


Advanced search

Re: [std-proposals] Array Index in Range-based For Loops

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 03 Mar 2023 08:11:59 -0800
On Friday, 3 March 2023 02:10:47 PST Andrey Semashev via Std-Proposals wrote:
> No, it's not. In a given header/TU, do you use `import` or `#include`?
> For a header, are you going to penalize its users by using `import`?
> Answers on these questions depend on whether one is cheaper than the
> other for a given set of used std features (or, put simply, the
> `#includes` there currently are). And `import` needs to be better in the
> majority of cases, down to single simple includes like `cstddef` and
> `utility`.

Though note that the #include is also a moving target because more stuff is
present in those includes when the C++ core language level is increased in the
compiler. <algorithm> is one of the worst offenders.

I do expect there to be a cross-over point where the module import will be
cheaper than the includes (or close enough) for the majority of cases when
then we'll see the switch-over. But yes, we'll see mixed #include and import
for oh, 10 years? 15 maybe.

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-03-03 16:12:02