jeudi 23 février 2017

Is it possible to initialize auto variable with auto class method?

I met some problem regarding auto specifier using c++14.
I defined the class in header file and has auto members named getData(). Then in main file, I tried to initialize auto variable with the auto method.

Then compiling with g++, I got following errors, test.cpp:21:30: error: use of ‘auto MiscFeature::getData()’ before deduction of ‘auto’ auto val = misc->getData();

If I define the similar function in main file, it's okay.

How could I fix such problem? Or is this a limitation?

Aucun commentaire:

Enregistrer un commentaire