• marcos@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    6 days ago

    Yeah… But it’s usually a good practice to put a struct somewhere between your 30 levels of ownership.

    Exceptions exist, but they are not very common. Also, in C++, operators overloading may help you if you keep needing to write code like this.

    • Gladaed@feddit.org
      link
      fedilink
      arrow-up
      3
      ·
      6 days ago

      In C++ you should never have owning raw pointers. Unless you have a good reason™.

      Raw pointers are great, but not for ownership.

        • Gladaed@feddit.org
          link
          fedilink
          arrow-up
          4
          ·
          6 days ago

          And you should.

          It even works for classes whose constructors your implementation cannot see, if you aren’t a bitch about it.