Mám nasledujúci kód
namespace Robo{
class Comparing{
public:
enum cmp {normal, reverse};
cmp mode;
Comparing(cmp m = normal) : mode(m) {}
bool operator==(const Comparing & c) {return mode == c.mode;}
};
template <typename T>
void swap(T & a, T & b);
template <typename T>
void bubbleSort(T field, int n, Comparing mode = Comparing::normal);
template <typename T>
void shakerSort(T field, int n, Comparing mode = Comparing::normal);
template <typename T>
void selectionSort(T field, int n, Comparing mode = Comparing::normal);
}
Problém nastane, keď chcem do funkcie predať referenciu triedy a nie kópiu.
void bubbleSort(T field, int n, Comparing & mode = Comparing::normal);
Vypíše mi nasledovnú chybu:
error C2440: 'default argument' : cannot convert from 'Robo::Comparing::cmp' to 'Robo::Comparing &'