X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d18a2c38d1b8ab12e529771945100be0b24f0288..8d62bb541920e2e4e0f7d1fa26a7f6eec79370c2:/include/xbt/utility.hpp diff --git a/include/xbt/utility.hpp b/include/xbt/utility.hpp index 6a3b542fbd..c35be72d7f 100644 --- a/include/xbt/utility.hpp +++ b/include/xbt/utility.hpp @@ -27,12 +27,11 @@ } \ static constexpr bool is_valid_##EnumType(int raw_value) \ { \ - return raw_value < _XBT_COUNT_ARGS(__VA_ARGS__); \ + return raw_value >= 0 && raw_value < _XBT_COUNT_ARGS(__VA_ARGS__); \ } \ enum class EnumType { __VA_ARGS__ } /* defined here to handle trailing semicolon */ -namespace simgrid { -namespace xbt { +namespace simgrid::xbt { /** @brief Replacement for C++20's std::type_identity_t */ @@ -80,6 +79,5 @@ template inline void intrusive_erase(List& list, Elem& list.erase(list.iterator_to(elem)); } -} // namespace xbt -} // namespace simgrid +} // namespace simgrid::xbt #endif