1 /* Copyright (c) 2016. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #ifndef SIMGRIX_XBT_MEMORY_HPP
8 #define SIMGRIX_XBT_MEMORY_HPP
15 /** Delete operator which call a `destroy()` free function */
17 struct destroy_delete {
18 void operator()(T* t) const
24 /** A `unique_ptr` which works for SimGrid C types (dynar, swag, automaton, etc.)
26 * It uses an overloaded `destroy()` function to delete the object.
29 using unique_ptr = std::unique_ptr<T, destroy_delete<T> >;