> On 01/19/2008 02:22 PM, Jon S. Berndt wrote in part: > > .... Pushing an object instance onto a vector is a bad idea, as a > proper copy constructor must then be created, > > Well ... that is exactly the point I'm trying to discuss. > > IMHO if you are going to write 23,000 lines of c++, it > might be worth your trouble to figure out how to write a > copy constructor. It ain't that tricky. You only need > to figure it out once, and then you can use the technique > over and over again.
Done it. Years ago. JSBSim has several copy constructors. But, they are more trouble than they are worth, IMO - particularly when classes are evolving over time, and one must then modify the copy constructor. When objects also include pointers to other objects, it's complicated. Copying is also more expensive. Pointers ain't that tricky once you figure them out. C++ was invented for a reason. :-) I actually moved away from explicit storage of objects in a vector recently, going with storage of pointers instead (adding the requisite destructors) and am very happy with the results. Seriously, this is open source code. If you think there's something that could be done better, try it, play with it, prove that it works better, is more readable, and more maintainable. To me, though, it seems like you are underscoring the fact that everyone codes differently. Jon ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel