Date: Sat, 25 Jan 2025 00:49:33 +0200
On Sat, 25 Jan 2025 at 00:46, Arthur O'Dwyer via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> On Fri, Jan 24, 2025 at 5:20 PM Breno GuimarĂ£es <brenorg_at_[hidden]> wrote:
>>
>> I also inherit from some containers to allow them to be forward declared and reduce the amount of template instantiation. I don't add any new functions or members so everything works well.
>> I don't do it for all types but just some vocabulary types.
>>
>> Not sure if anyone mentioned that usecase yet (or if there is a categorily better option).
>
> Could you show an example of what you mean? I can't picture it.
Well, you can't forward-declare std::vector. But you can easily
forward-declare a MyVec that later ends up being defined
as a class that inherits std::vector, and no knowledge of that
inheritance is required at the point of the forward declaration.
<std-proposals_at_[hidden]> wrote:
>
> On Fri, Jan 24, 2025 at 5:20 PM Breno GuimarĂ£es <brenorg_at_[hidden]> wrote:
>>
>> I also inherit from some containers to allow them to be forward declared and reduce the amount of template instantiation. I don't add any new functions or members so everything works well.
>> I don't do it for all types but just some vocabulary types.
>>
>> Not sure if anyone mentioned that usecase yet (or if there is a categorily better option).
>
> Could you show an example of what you mean? I can't picture it.
Well, you can't forward-declare std::vector. But you can easily
forward-declare a MyVec that later ends up being defined
as a class that inherits std::vector, and no knowledge of that
inheritance is required at the point of the forward declaration.
Received on 2025-01-24 22:49:48