I have some C++11 code using the auto
inferred type that I have to convert to C++98. How would I go about converting the code, substituting in the actual type f
An alternative approach would be to use function templates and type deduction. It may not work in all examples you have but it may help in some cases:
int foo ()
{
auto x = bar();
// do something with 'x'
}
Change this to:
template int foo_(T x)
{
// do something with 'x'
}
int foo ()
{
foo_(bar());
}
auto
is specified in terms of type deduction, so the above should have very similar, if not identical semantics as the C++ '11 version.