-
Notifications
You must be signed in to change notification settings - Fork 210
Closed
Labels
Affects: YARP v2.3.72This is a known issue affecting YARP v2.3.72This is a known issue affecting YARP v2.3.72Component: Library - YARP_mathFixed in: YARP v3.0.0Issue Type: BugInvolves some intervention from a system administratorInvolves some intervention from a system administratorResolution: FixedType: Breaking/Behaviour ChangeInvolves breaking user code or behaviourInvolves breaking user code or behaviour
Description
Vector
and Matrix
operators are defined inside the yarp::math
namespace.
yarp/src/libYARP_math/include/yarp/math/Math.h
Lines 16 to 27 in 29e9108
namespace yarp | |
{ | |
/** | |
* Mathematical operations. | |
*/ | |
namespace math | |
{ | |
/** | |
* Addition operator between a scalar and a vector (defined in Math.h). | |
* Sum the scalar to all the elements of the vector. | |
*/ | |
YARP_math_API yarp::sig::Vector operator+(const yarp::sig::Vector &a, const double &s); |
This means that, in order to perform an operation (for example Vector b = a + s;
), the user has to add using namespace yarp::math;
or to call the operator explicitly, i.e. (I think) something like this: Vector b = yarp::math::operator+(a, s);
The first option is considered bad practice, and the second option is just wrong.
I think we could just move them outside of the namespace, the only effect is if someone is using the second syntax, but I don't think anyone would be doing that...
claudiofantacci and diegoferigoclaudiofantacci
Metadata
Metadata
Labels
Affects: YARP v2.3.72This is a known issue affecting YARP v2.3.72This is a known issue affecting YARP v2.3.72Component: Library - YARP_mathFixed in: YARP v3.0.0Issue Type: BugInvolves some intervention from a system administratorInvolves some intervention from a system administratorResolution: FixedType: Breaking/Behaviour ChangeInvolves breaking user code or behaviourInvolves breaking user code or behaviour