#include
#include
#include
using namespace std;
bool norm_less_than( const vector& a,const vector& b );
int main( )
{
const double data1[] = { 1.77, 3.33, -0.44 };
const double data2[] = { -1.99, -2.11, 4.33 };
vector v1( data1, data1+sizeof( data1 )/sizeof( double ) );
vector v2( data2, data2+sizeof( data2 )/sizeof( double ) );
const vector& min_vector = min( v1, v2, norm_less_than );
const vector& max_vector = max( v1, v2, norm_less_than );
}
// returns true if the norm of a is < norm of b, false otherwise
inline
bool norm_less_than( const vector& a,const vector& b )
{
return inner_product( a.begin(), a.end(), a.begin(), 0.0 )
< inner_product( b.begin(), b.end(), b.begin(), 0.0 );
}