Skip to content
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

880 change Holder::foreach() to return void #993

Merged
merged 1 commit into from
Aug 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/vt/vrt/collection/holders/col_holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct CollectionHolder : BaseHolder {
bool is_static_ = false; /**< Whether is static sized */
HandlerType map_fn = uninitialized_handler; /**< The map function */
IndexT max_idx; /**< Index range for collection */
Holder<ColT,IndexT> holder_; /**< Inner holder of elements */
Holder<ColT, IndexT> holder_; /**< Inner holder of elements */
};

}}} /* end namespace vt::vrt::collection */
Expand Down
4 changes: 1 addition & 3 deletions src/vt/vrt/collection/holders/holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,8 @@ struct Holder {
* \brief Perform apply action over all collection elements
*
* \param[in] fn apply function for each element
*
* \return whether it succeeded (always true)
*/
bool foreach(FuncApplyType fn);
void foreach(FuncApplyType fn);

/**
* \brief Count number of elements
Expand Down
5 changes: 2 additions & 3 deletions src/vt/vrt/collection/holders/holder.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void Holder<ColT, IndexT>::cleanupExists() {
}

template <typename ColT, typename IndexT>
bool Holder<ColT, IndexT>::foreach(FuncApplyType fn) {
void Holder<ColT, IndexT>::foreach(FuncApplyType fn) {
static uint64_t num_reentrant = 0;

num_reentrant++;
Expand All @@ -162,15 +162,14 @@ bool Holder<ColT, IndexT>::foreach(FuncApplyType fn) {
auto const& idx = elm.first;
auto const& holder = elm.second;
auto const col_ptr = holder.getCollection();
fn(idx,col_ptr);
fn(idx, col_ptr);
}
}
num_reentrant--;

if (num_reentrant == 0) {
cleanupExists();
}
return true;
}

template <typename ColT, typename IndexT>
Expand Down