We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One day, I wrote this:
double z = data.getField<boost::int32_t>(pointIndex, indexZ);
where of course I really meant this:
double z = data.getField<double>(pointIndex, indexZ);
Note the wrong template type. The problem here is that there's no way to typecheck the return type T is the type we want.
Hobu suggests decltype might help ( http://en.wikipedia.org/wiki/Decltype).
mpg alternatively suggests changing the function from this:
T getField(std::size_t ptIdx, boost::int32_t fieldIdx)
to this:
void getField(std::size_t ptIdx, boost::int32_t fieldIdx, T& ret)
Neither suggestion is very palatable, though.
The text was updated successfully, but these errors were encountered:
getField is slightly better now (you must pass in the actual dimension instance, not just a dimension position), but this same issue can still happen.
getField is the critical path, however, and any checking in here causes things to be slow. I don't know that we want to try to do type checking.
Sorry, something went wrong.
Closing. get/setField now take in a Dimension object, which while not eliminating the type mismatch thing, lessens it greatly.
No branches or pull requests
One day, I wrote this:
where of course I really meant this:
Note the wrong template type. The problem here is that there's no way to typecheck the return type T is the type we want.
Hobu suggests decltype might help ( http://en.wikipedia.org/wiki/Decltype).
mpg alternatively suggests changing the function from this:
to this:
Neither suggestion is very palatable, though.
The text was updated successfully, but these errors were encountered: