On Fri, Jan 24, 2025 at 5:20 PM Breno Guimarães <brenorg@gmail.com> 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.

I did see that some uses in LLVM seem like people are writing
    struct MyVec : std::vector<int> {};
simply as a kind of "mangling firewall," where the "natural" thing to write (in the absence of any external constraints) would have been simply:
    using MyVec = std::vector<int>;
In the latter case the mangled symbol names would have contained "std::__1::vector<int, std::__1::allocator<int>>"; in the former case they'll simply contain "MyVec", which is (1) shorter, (2) easier to read in the debugger, and (3) more stable in case this is a long-lived shared-library ABI boundary.

–Arthur