X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5ed37babb2fa9097abe82df299c0aa259ed84d5a..639c6962daa378323864a53174e0e7fe2fcaef1e:/include/xbt/utility.hpp diff --git a/include/xbt/utility.hpp b/include/xbt/utility.hpp index 34dc34e92a..bb599d6c29 100644 --- a/include/xbt/utility.hpp +++ b/include/xbt/utility.hpp @@ -25,6 +25,10 @@ constexpr std::array names{{_XBT_STRINGIFY_ARGS(__VA_ARGS__)}}; \ return names.at(static_cast(value)); \ } \ + static constexpr bool is_valid_##EnumType(int raw_value) \ + { \ + return raw_value >= 0 && raw_value < _XBT_COUNT_ARGS(__VA_ARGS__); \ + } \ enum class EnumType { __VA_ARGS__ } /* defined here to handle trailing semicolon */ namespace simgrid { @@ -76,6 +80,6 @@ template inline void intrusive_erase(List& list, Elem& list.erase(list.iterator_to(elem)); } -} -} +} // namespace xbt +} // namespace simgrid #endif