-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
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
Reuse sample::get implementation #3471
Conversation
@@ -212,7 +212,7 @@ class tile_data { | |||
bool reusable; | |||
|
|||
public: | |||
tile_data() : c(nullptr), index(0), reusable(false), data(nullptr) { | |||
tile_data() : c(nullptr), index(TILE_COUNT), reusable(false), data(nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken - index=0 is actually a valid index. So it's better to fill it with invalid index value
template <class coords_t> std::vector<double> sample::get_all(const coords_t& coords) { | ||
std::vector<double> values; | ||
values.reserve(coords.size()); | ||
uint16_t curIndex = TILE_COUNT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tile_data
already stores index so I just added tile_data::get_index
getter to obtain it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks good to me, do you mind adding that extra comment for clarity?
Co-authored-by: Kevin Kreiser <kevinkreiser@gmail.com>
Sure thing! done |
Issue
Previously we had duplicated logic for
sample::get
andsample::get_all
. The PRget(coord, tile&)
(like we have in GraphReader)tile_data
index to invalid value(i.eTILE_COUNT
instead of 0)Tasklist
Requirements / Relations
Link any requirements here. Other pull requests this PR is based on?