Skip to content

Commit

Permalink
#1782: don't pass primitive types by reference
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed May 9, 2022
1 parent 19a1056 commit 503ceec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/vt/group/region/group_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ List::List(List const& in_other, BoundType in_remove_extent) {
}

List::List(
BoundType const* const list, SizeType const& size, bool const& is_sorted
BoundType const* const list, SizeType const size, bool const is_sorted
) {
ListType new_list;
for (SizeType elm = 0; elm < size; elm++) {
Expand Down Expand Up @@ -128,7 +128,7 @@ List::List(
}

/*virtual*/ List::SplitRegionType List::split() const {
auto const& size = getSize();
auto const size = getSize();
vtAssert(
size >= 2, "Size must be at least 2 to split"
);
Expand All @@ -153,12 +153,12 @@ List::List(
}

/*virtual*/ void List::splitN(int nsplits, ApplyFnType apply) const {
auto const& size = static_cast<int>(getSize());
auto const& num_splits = std::min(nsplits, size);
auto const size = static_cast<int>(getSize());
auto const num_splits = std::min(nsplits, size);
int cur_idx = 0;
for (auto split = 0; split < num_splits; split++) {
auto const& child_size = size / num_splits;
auto const& cur_max = split == num_splits - 1 ?
auto const child_size = size / num_splits;
auto const cur_max = split == num_splits - 1 ?
size : std::min(size, cur_idx + child_size);
ListType list;
for (int i = cur_idx; i < cur_max; i++) {
Expand Down
4 changes: 3 additions & 1 deletion src/vt/group/region/group_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@
#if !defined INCLUDED_VT_GROUP_REGION_GROUP_LIST_H
#define INCLUDED_VT_GROUP_REGION_GROUP_LIST_H

#include "vt/group/region/group_region.h"

namespace vt { namespace group { namespace region {

struct List : Region {
explicit List(ListType const& in_list);
explicit List(ListType&& in_list);
List(List const& in_other, BoundType in_remove_extent);
List(BoundType const* const list, SizeType const& size, bool const& is_sorted);
List(BoundType const* const list, SizeType const size, bool const is_sorted);

List(List const&) = default;
List(List&&) = default;
Expand Down

0 comments on commit 503ceec

Please sign in to comment.