Bug #840

std::max compliance of RealVector

Added by C. Emmerich about 12 years ago. Updated about 12 years ago.

Status:ResolvedStart date:02/02/2012
Priority:NormalDue date:
Assignee:M. Rolf% Done:

100%

Category:-
Target version:NemoMath 0.4

Description

In the following example


#include <stdio.h>
#include <iostream>
#include <nemo/Vector.h>

using namespace std;
using namespace nemo;

int main() {
    RealVector v = {0.1, 0.5};
    cout << "v=" << v << endl;
    cout << "max(v[0], 3.0)=" << max(v[0], 3.0) << endl;
    return 0;
}

the compiler puts the following error:

error: no matching function for call to ‘max(nemo::MathVector<double>::ReadWriteRef, double)’

History

#1 Updated by M. Rolf about 12 years ago

Likely solution:
provide 'friend inline min/max' methods inside ReadWriteRef namespace.
Same thing as with custom 'swap' implementation.
Actually it seems that max/min/swap are the only functions in STL that do not rely on iterator-based access, so this fix should cover the entire STL compliance.

#2 Updated by M. Rolf about 12 years ago

  • Target version set to NemoMath 0.4

#3 Updated by M. Rolf about 12 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF