Bugzilla – Bug 1384
Several helper functions for Vector class
Last modified: 2012-04-24 08:32:13 EDT
To following patch implements a useful set of helpers that can simplify various calculations on vectors. The set is incomplete and if people think this would be useful, I can add missing operations. - Math operators with double: +, +=, *, -, / - Math operators (component-wise) with another vector: +, +=, *, - - length of the vector (Euclidean distance from 0,0,0) - scalar vector multiplication
Created attachment 1348 [details] patch
+1 (with the missing operators). Since ns-3 might be linked also with boost, and boost does have vector rtemplates, it might be as well interesting to have casting operators (if possible). On the other hand they'd need to be compilation-aware, as boost might be missing as well. T.
1) ScalarMultiplication is a really bad misnomer. 2) The operator coverage is far from complete. Most users who might use your operators will simply not understand why some are implemented and others are not and they will not know what to do when their code fails to build with strange compiler messages. i.e., the outcome of missing operators is very surprising for most users.