Skip to content

Commit

Permalink
#880: change Holder::foreach() to return void
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Strzebonski committed Aug 18, 2020
1 parent 3dfddb2 commit 27e83cd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
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

0 comments on commit 27e83cd

Please sign in to comment.