typedefdoubleconst (*t_p_training_function)(std::vector<double> const&); // training function pointer type
The MS C++ docs say this about that error:
anachronism used : qualifiers on reference are ignored
Using qualifiers like const or volatile with C++ references is an outdated practice.
Which I don't really understand. Why is using a const qualifier on a reference outdated? It's exactly what I want to do in this case (ie. I want a reference to it and I don't want to modify it).
Should I just pass it as const? Will this have the same effect? Even so, what's wrong with the "reference" just for added clarity?
test.cc:4:16: warning: 'const' type qualifier on return type has no effect
[-Wignored-qualifiers]
typedef double const (*t_p_training_function)(std::vector<double> const&);
g++ says
test.cc:4:73: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
typedef double const (*t_p_training_function)(std::vector<double> const&);
Intel says
test.cc(4): warning #858: type qualifier on return type is meaningless
typedef double const (*t_p_training_function)(std::vector<double> const&);
^
What version of VC++ are you using? Neither VC++10 nor VC++11 generate an error for that code.
[edit:
On the other hand it is generated as a warning in VC++11 for some slightly different code:
typedefdoubleconst (*t_p_training_function)(std::vector<double> & const); where it looks like the intention is for const to modify the reference and not what is referenced.
]