Jonathan Wakely wrote:
>>
>On Sun, 9 Feb 2025, 00:24 Frederick Virchanza Gotham wrote:
>> As the GNU compiler make its way through a translation unit, more and
>> more classes get declared. So for each translation unit, the compiler
>> maintains a list of what types it has seen so far.
>>
>> Could someone please point me to where in the GNU g++ source code I
>> will find this container object? What's the name of the container, and
>> in what source file is it defined?
>>
>> I want to add 'std::vector' to the container implicitly so that we can
>> write a translation unit without needing to do "#include <vector>". My
>> end game idea is to add forward declarations for all standard library
>> classes.
>
>
> Why? That seems like it will just permit invalid code.
>
> Why not use 'import std;' instead?



This would be an alternative to modules (seeing as how modules might
become deprecated in the future).

The idea is that every standard library class would be implicitly
forward-declared, meaning you don't have to do "#include <vector>" if
you need a forward declaration for std::vector.

Reply via email to