Skip to content

Commit

Permalink
throw -> std::cerr + exit(-1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldhulipala committed Apr 26, 2023
1 parent 6669abe commit 1fd7e15
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions include/parlay/delayed_sequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ class delayed_sequence {
// Subscript access with bounds checking
T at(size_t i) const {
if (i < first || i >= last) {
std::cerr << std::out_of_range("Delayed sequence access out of"
std::cerr << "Delayed sequence access out of"
"range at " + std::to_string(i) +
"for a sequence with bounds [" +
std::to_string(first) + ", " +
std::to_string(last) + ")") << std::endl;
std::to_string(last) + ")" << std::endl;
exit(-1);
}
return f(i);
Expand Down
8 changes: 4 additions & 4 deletions include/parlay/internal/uninitialized_sequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ class uninitialized_sequence {

value_type& at(size_t i) {
if (i >= size()) {
std::cerr << std::out_of_range("uninitialized_sequence access out of bounds: length = " +
std::to_string(size()) + ", index = " + std::to_string(i)) << std::endl:
std::cerr << "uninitialized_sequence access out of bounds: length = " +
std::to_string(size()) + ", index = " + std::to_string(i) << std::endl:
exit(-1);
}
else {
Expand All @@ -178,8 +178,8 @@ class uninitialized_sequence {

const value_type& at(size_t i) const {
if (i >= size()) {
std::cerr << std::out_of_range("uninitialized_sequence access out of bounds: length = " +
std::to_string(size()) + ", index = " + std::to_string(i)) << std::endl;
std::cerr << "uninitialized_sequence access out of bounds: length = " +
std::to_string(size()) + ", index = " + std::to_string(i) << std::endl;
exit(-1);
}
else {
Expand Down
4 changes: 2 additions & 2 deletions include/parlay/sequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ class sequence : protected sequence_internal::sequence_base<T, Allocator, Enable

const value_type& at(size_t i) const {
if (i >= size()) {
std::cerr << std::out_of_range("sequence access out of bounds: length = " + std::to_string(size()) +
", index = " + std::to_string(i)) << std::endl;
std::cerr << "sequence access out of bounds: length = " + std::to_string(size()) +
", index = " + std::to_string(i) << std::endl;
exit(-1);
} else {
return storage.at(i);
Expand Down

0 comments on commit 1fd7e15

Please sign in to comment.