Right now it seems like sentinel values, in particular -1, are hard-coded. It would be nice to have one or more constants defined that eliminated the need for that hard coding, e.g.,
constexpr int INDEX_UNSPECIFIED = -1;
If we wanted to, there could be a constant defined per use case.
EDIT: alternatively we could move towards std::optional, which is the C++ way but has its drawbacks.
Right now it seems like sentinel values, in particular
-1, are hard-coded. It would be nice to have one or more constants defined that eliminated the need for that hard coding, e.g.,If we wanted to, there could be a constant defined per use case.
EDIT: alternatively we could move towards
std::optional, which is the C++ way but has its drawbacks.