lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi:

...
>> a lot more copying of data structures ??? think about C++ vectors getting
>> copied around just like they were integer values ??? which in its own way
>> ups memory usage even if it remains precise.

If your C++ vectors are getting copied around like that, your STL
implementation sucks. Good implementations provide copy-on-write
semantics or (as of C++11) move semantics.

In C++ if your vectors are getting copied is because you want them copied, else you use references, which really are non-null pointers with a little syntactic sugar.

IMO one of the beauties of C++ is precisely that you CAN pass objects by value if you want. And if you do not want your objects copied, you can arrange for this too. It is not an easy language, but you can be very precise specifying the behaviour of your objects, this flexiblity has a cost.

F.O.S.