Had following type:
typedef pair<double, double> MinMax; ///< first - Min, second - Max
and initialization with it worked fine:
const MinMax mInMinMax[FunctionCount] = {{-1, 1}, {-1, 1}, {0, 1}};
However if I subclass pair for convenience:
///< first - Min, second - Max
struct MinMax : public pair<double, double>
{
double& Min() { return first; }
double Min() const { return first; }
double& Max() { return second; }
double Max() const { return second; }
};
Compilation fails with error:
error: could not convert ‘{-1, 1}’ from ‘<brace-enclosed initializer list>’ to ‘const MinMax’ const MinMax mInMinMax[FunctionCount] = {{-1, 1}, {-1, 1}, {0, 1}};
Is it possible to subclass pair<double, double>
correctly?