Hi, lets say i have two arbitary container of any stl type.
template
<
class T,
template <typename ELEM, typename = std::allocator<ELEM> >
class CONT
>
typename boost::enable_if<boost::is_floating_point<T>, T>::type
getManhattanDistance(const CONT<T>& ObjectX, const CONT<T>& ObjectY)
I want to be able to iterate through both containers to get the euclidean distance.. i.e.
sqrt of sum of each item in ObjectX - ObjectY square.
Psuedocode looks like this..
/***********************************************
* getManhattanDistance(ObjectX, ObjectY) *
* overAllSum <-- 0 *
* for i <-- 0 to sizeof (ObjectX) *
* Xn <-- ObjectX[i] *
* Yn <-- ObjectY[i] *
* difference <-- (Xn - Yn) * -1 *
* overAllSum <-- overAllSum + difference *
***********************************************/
but i want to make it as abstract (allowing nonindexable containers) but also clear as possible without losing speed. Whats the best way to do this using boost library.