Skip to content

Commit

Permalink
Oops. Revert "Fix range constexpr (celeritas-project#1064)"
Browse files Browse the repository at this point in the history
This reverts commit fb9d322.
  • Loading branch information
amandalund committed Dec 14, 2023
1 parent fb9d322 commit 62d9a05
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/corecel/cont/detail/RangeImpl.hh
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,12 @@ class range_iter
public:
//// CONSTRUCTOR ////

CELER_FORCEINLINE_FUNCTION range_iter(value_type value) : value_(value)
CELER_CONSTEXPR_FUNCTION range_iter(value_type value = TraitsT::zero())
: value_(value)
{
CELER_EXPECT(TraitsT::is_valid(value_));
}

CELER_CONSTEXPR_FUNCTION range_iter() : value_(TraitsT::zero()) {}

//// ACCESSORS ////

CELER_CONSTEXPR_FUNCTION value_type operator*() const { return value_; }
Expand Down
4 changes: 2 additions & 2 deletions src/orange/BoundingBoxUtils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ template<class T, class U>
inline CELER_FUNCTION bool
is_inside(BoundingBox<T> const& bbox, Array<U, 3> point)
{
auto axes = range(to_int(Axis::size_));
constexpr auto axes = range(to_int(Axis::size_));
return all_of(axes.begin(), axes.end(), [&point, &bbox](int ax) {
return point[ax] >= bbox.lower()[ax] && point[ax] <= bbox.upper()[ax];
});
Expand Down Expand Up @@ -67,7 +67,7 @@ inline bool is_degenerate(BoundingBox<T> const& bbox)
{
CELER_EXPECT(bbox);

auto axes = range(to_int(Axis::size_));
constexpr auto axes = range(to_int(Axis::size_));
return any_of(axes.begin(), axes.end(), [&bbox](int ax) {
return bbox.lower()[ax] == bbox.upper()[ax];
});
Expand Down
7 changes: 3 additions & 4 deletions test/corecel/cont/Range.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,9 @@ TEST(RangeTest, enums)
++ctr;
}

if (CELERITAS_DEBUG)
{
EXPECT_THROW(range(static_cast<pokemon::Pokemon>(100)), DebugError);
}
#if CELERITAS_DEBUG
EXPECT_THROW(range(static_cast<pokemon::Pokemon>(100)), DebugError);
#endif
}

TEST(RangeTest, different_enums)
Expand Down

0 comments on commit 62d9a05

Please sign in to comment.