-8

I try to call some functions stacked in vector. I did:

DataReader* GPSR_Ptr = new DataReader();
typedef leap::float64 (DataReader::*getFonction)();
std::vector<getFonction> vec (&DataReader::getLat);

But that didn't work.

NathanOliver
  • 171,901
  • 28
  • 288
  • 402

1 Answers1

3

std::vector has no constructor taking a single value. Use an initializer list :

std::vector<getFonction> vec {&DataReader::getLat};

If you are stuck in 2003, you can also use the filling constructor :

std::vector<getFonction> vec(1, &DataReader::getLat);

But beware that it will copy the parameter, which you may not want for other types.

Quentin
  • 62,093
  • 7
  • 131
  • 191