> On Jan 19, 2016, at 16:09, Marc Mutz <marc.m...@kdab.com> wrote: > > On Tuesday 19 January 2016 14:33:46 Giuseppe D'Angelo wrote: >> On Tue, Jan 19, 2016 at 3:07 PM, Marc Mutz <marc.m...@kdab.com> wrote: >>> I'd aggregate the std container instead of inheriting it, but yes, that's >>> a good idea. I just wrote a mail suggesting essentially the same, only >>> slower. >>> But I'd have nothing against going all-in, either. >> >> We can't "suddenly" break CoW, though. Who's going to review the millions >> of lines of code where copies where happily taken assuming they were cheap? > > Who's reviewing the millions of lines of code where hidden detaches are > happily incurred even though they are not cheap? > > I'd say that if you took copies in a tight loop, you'll notice and the > profiler > will find it for you. And the rest don't matter, or they will be found by > Clazy. > > I doubt many people actively use the fact that Qt containers are cheap to > copy.
Each and every developer that uses Qt uses the fact that Qt containers are cheap to “copy" class A { public: QVector<B> something() const; private: QVector<B> m_something; }; QVector<B> A::something() const { return m_something; } Br, Eike > But yes, Qt API needs to be reviewed with an eye towards this. Then > again, Non-Qt C++ would be horribly slow if copying containers was so > prohibitly expensive. > > Thanks, > Marc > > -- > Marc Mutz <marc.m...@kdab.com> | Senior Software Engineer > KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company > Tel: +49-30-521325470 > KDAB - The Qt Experts > _______________________________________________ > Development mailing list > Development@qt-project.org > http://lists.qt-project.org/mailman/listinfo/development _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development