X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1830ec873b286ded8981e8fb3327715d1e6a737f..78cfd86352a4b7097c255e40e8eb98619d515926:/src/xbt/dynar.cpp diff --git a/src/xbt/dynar.cpp b/src/xbt/dynar.cpp index 2670fc5bc5..5c62e73975 100644 --- a/src/xbt/dynar.cpp +++ b/src/xbt/dynar.cpp @@ -11,6 +11,7 @@ #include "xbt/ex.h" #include "xbt/log.h" #include "xbt/misc.h" +#include "xbt/string.hpp" #include "xbt/sysdep.h" #include @@ -29,15 +30,15 @@ static inline void _sanity_check_idx(int idx) static inline void _check_inbound_idx(xbt_dynar_t dynar, int idx) { if (idx < 0 || idx >= static_cast(dynar->used)) { - THROWF(bound_error, idx, "dynar is not that long. You asked %d, but it's only %lu long", - idx, static_cast(dynar->used)); + throw std::out_of_range(simgrid::xbt::string_printf("dynar is not that long. You asked %d, but it's only %lu long", + idx, static_cast(dynar->used))); } } static inline void _check_populated_dynar(xbt_dynar_t dynar) { if (dynar->used == 0) { - THROWF(bound_error, 0, "dynar %p is empty", dynar); + throw std::out_of_range(simgrid::xbt::string_printf("dynar %p is empty", dynar)); } } @@ -215,7 +216,7 @@ void xbt_dynar_free_voidp(void* d) /** @brief Count of dynar's elements * - * @param dynar the dynar we want to mesure + * @param dynar the dynar we want to measure */ unsigned long xbt_dynar_length(const xbt_dynar_t dynar) { @@ -431,8 +432,8 @@ void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned int n, const * } * @endcode * - * Raises not_found_error if not found. If you have less than 2 millions elements, you probably want to use - * #xbt_dynar_search_or_negative() instead, so that you don't have to TRY/CATCH on element not found. + * Raises std::out_of_range if not found. If you have less than 2 millions elements, you probably want to use + * #xbt_dynar_search_or_negative() instead, so that you don't have to try/catch on element not found. */ unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void* const elem) { @@ -443,7 +444,7 @@ unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void* const elem) return it; } - THROWF(not_found_error, 0, "Element %p not part of dynar %p", elem, dynar); + throw std::out_of_range(simgrid::xbt::string_printf("Element %p not part of dynar %p", elem, dynar)); } /** @brief Returns the position of the element in the dynar (or -1 if not found) @@ -521,7 +522,7 @@ void xbt_dynar_pop(xbt_dynar_t const dynar, void* const dst) xbt_dynar_remove_at(dynar, dynar->used - 1, dst); } -/** @brief Add an element at the begining of the dynar. +/** @brief Add an element at the beginning of the dynar. * * This is less efficient than xbt_dynar_push() */