-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
  • 161,918
  • 27
  • 262
  • 366

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
  • 60,592
  • 7
  • 125
  • 183