Hello,
I've started to put qvector.h and qvector.cpp in a shape that I like
more. However, there are a few strange things:
- can't find the implementation of the operator:
QuickVector & QuickVector::operator*=(const double y);
The operator appeares in the header, but not in the cpp file.
- what's the difference between
inline double &operator[]( const int i)
and
inline double operator[]( const int i) const
These look stange to me, because C++ should make difference between
methods by their name and parameter definition, not by the return type;
also the same operator is constant or not?
- the return type in the operator declaration
QuickVector &operator-(const QuickVector &y) const;
looks also stange, because here:
http://www.java2s.com/Code/Cpp/Overload/DemoOverloadtheandrelativetoMyClass.htm
the "-" operator returns a simple object, not a reference. The current
declaration might produce memory leak.
Personally I would prefer to not to use operator overloading at all, as
usually it's too complicated and too error-prone. Instead some methods
could be used.
Also a remark: I'm starting to convert tabs into 4 spaces, as this is the
preferred way in kde style c++ coding.
Zoltan
------------------------------------------------------------------------------
_______________________________________________
Ktechlab-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ktechlab-devel