A
Alan
Am I missing some sort of declaration or is there a syntax error in
the definition of the binary function object "less_metric1" below? My
compiler says: "ISO C++ forbids declaration of `return_type' with no
type."
Thanks, Alan
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
using namespace std;
class measurement
{
public:
double metric1, metric2, metric3;
};
class less_metric1 : binary_function<measurement, measurement, bool>
{
public:
return_type operator()(const measurement& a, const measurement& b)
{
return a.metric1 < b.metric1;
}
};
int main()
{
// Create objects
measurement data1, data2, data3;
data1.metric1 = 1; data1.metric2 = 2; data1.metric3 = 3;
data2.metric1 = 2; data2.metric2 = 3; data2.metric3 = 1;
data3.metric1 = 3; data3.metric2 = 2; data3.metric3 = 1;
system("PAUSE");
}
the definition of the binary function object "less_metric1" below? My
compiler says: "ISO C++ forbids declaration of `return_type' with no
type."
Thanks, Alan
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
using namespace std;
class measurement
{
public:
double metric1, metric2, metric3;
};
class less_metric1 : binary_function<measurement, measurement, bool>
{
public:
return_type operator()(const measurement& a, const measurement& b)
{
return a.metric1 < b.metric1;
}
};
int main()
{
// Create objects
measurement data1, data2, data3;
data1.metric1 = 1; data1.metric2 = 2; data1.metric3 = 3;
data2.metric1 = 2; data2.metric2 = 3; data2.metric3 = 1;
data3.metric1 = 3; data3.metric2 = 2; data3.metric3 = 1;
system("PAUSE");
}