SG_END_DECL()
-#ifdef __cplusplus
-namespace simgrid {
-namespace xbt {
- inline void destroy(xbt_automaton_t a)
- {
- xbt_automaton_free(a);
- }
-}
-}
-#endif
-
#endif
SG_END_DECL()
-#ifdef __cplusplus
-namespace simgrid {
-namespace xbt {
- inline void destroy(xbt_dict_t d)
- {
- xbt_dict_free(&d);
- }
-}
-}
-#endif
-
#endif /* _XBT_DICT_H */
/** @} */
SG_END_DECL()
-#ifdef __cplusplus
-namespace simgrid {
-namespace xbt {
- inline void destroy(xbt_dynar_t s)
- {
- xbt_dynar_free(&s);
- }
-}
-}
-#endif
-
#endif /* _XBT_DYNAR_H */
[](void* p) { delete *(T**)p; });
}
-/** Dynar of `T*` which `destroy()` its values */
-template<class T> inline
-xbt_dynar_t newDestroyDynar()
-{
- return xbt_dynar_new(sizeof(T*),
- [](void* p) { simgrid::xbt::destroy(*(T**)p); });
-}
-
}
}
#endif
SG_END_DECL()
-#ifdef __cplusplus
-namespace simgrid {
-namespace xbt {
- inline void destroy(xbt_fifo_t f)
- {
- xbt_fifo_free(f);
- }
-}
-}
-#endif
-
#endif /* _XBT_FIFO_H */
/* @} */
SG_END_DECL()
-#ifdef __cplusplus
-namespace simgrid {
-namespace xbt {
- inline void destroy(xbt_heap_t h)
- {
- xbt_heap_free(h);
- }
-}
-}
-#endif
-
#endif /* _XBT_HEAP_H */
SG_END_DECL()
-#ifdef __cplusplus
-namespace simgrid {
-namespace xbt {
- inline void destroy(xbt_lib_t l)
- {
- xbt_lib_free(&l);
- }
-}
-}
-#endif
-
#endif /* _XBT_LIB_H */
namespace simgrid {
namespace xbt {
-/** Delete operator which call a `destroy()` free function */
-template<class T>
-struct destroy_delete {
- void operator()(T* t) const
- {
- destroy(t);
- }
-};
-
-/** A `unique_ptr` which works for SimGrid C types (dynar, swag, automaton, etc.)
- *
- * It uses an overloaded `destroy()` function to delete the object.
- */
-template<class T>
-using unique_ptr = std::unique_ptr<T, destroy_delete<T> >;
-
}
}
SG_END_DECL()
-#ifdef __cplusplus
-namespace simgrid {
-namespace xbt {
- inline void destroy(xbt_parmap_t p)
- {
- xbt_parmap_destroy(p);
- }
-}
-}
-#endif
-
#endif
SG_END_DECL()
-#ifdef __cplusplus
-namespace simgrid {
-namespace xbt {
- inline void destroy(xbt_swag_t s)
- {
- xbt_swag_free(s);
- }
-}
-}
-#endif
-
#endif /* _XBT_SWAG_H */