X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6f48d1a65eeb69ebae17feb1d714db4a60764a51..e553a03ec20f531e48fab905d2034551c58a683f:/include/xbt/dynar.h diff --git a/include/xbt/dynar.h b/include/xbt/dynar.h index 9ac385ff20..d9796b51f9 100644 --- a/include/xbt/dynar.h +++ b/include/xbt/dynar.h @@ -23,10 +23,12 @@ SG_BEGIN_DECL() * * For performance concerns, the content of DynArr must be homogeneous (in contrary to dictionnaries -- see the * \ref XBT_dict section). You thus have to provide the function which will be used to free the content at - * structure creation (of type void_f_ppvoid_t or void_f_pvoid_t). + * structure creation (of type void_f_pvoid_t). + * + * @deprecated If you are using C++, you might want to use `std::vector` instead. * * \section XBT_dynar_exscal Example with scalar - * \dontinclude dynar.c + * \dontinclude dynar.cpp * * \skip Vars_decl * \skip dyn @@ -64,6 +66,7 @@ SG_BEGIN_DECL() typedef struct xbt_dynar_s *xbt_dynar_t; XBT_PUBLIC(xbt_dynar_t) xbt_dynar_new(const unsigned long elm_size, void_f_pvoid_t const free_f); +XBT_PUBLIC(void) xbt_dynar_init(xbt_dynar_t dynar, const unsigned long elmsize, void_f_pvoid_t const free_f); XBT_PUBLIC(void) xbt_dynar_free(xbt_dynar_t * dynar); XBT_PUBLIC(void) xbt_dynar_free_voidp(void *dynar); XBT_PUBLIC(void) xbt_dynar_free_container(xbt_dynar_t * dynar); @@ -203,7 +206,7 @@ typedef struct xbt_dynar_s { void_f_pvoid_t free_f; } s_xbt_dynar_t; -static XBT_INLINE int _xbt_dynar_cursor_get(const xbt_dynar_t dynar, unsigned int idx, void *const dst) +static inline int _xbt_dynar_cursor_get(const xbt_dynar_t dynar, unsigned int idx, void *const dst) { if (!dynar) /* iterating over a NULL dynar is a no-op */ return FALSE; @@ -256,6 +259,6 @@ xbt_dynar_foreach (dyn,cpt,str) { (_cursor)++ ) #endif /** @} */ - SG_END_DECL() + #endif /* _XBT_DYNAR_H */