X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/340cf8df326e4bbb67c046172f8a73eecc6a3583..a250bd9db089b639e2298265b21577765a51f1bc:/include/xbt/dynar.hpp diff --git a/include/xbt/dynar.hpp b/include/xbt/dynar.hpp index 7ef2e68f4f..d9f77b5c76 100644 --- a/include/xbt/dynar.hpp +++ b/include/xbt/dynar.hpp @@ -1,14 +1,13 @@ -/* Copyright (c) 2004-2007, 2009-2015. The SimGrid Team. +/* Copyright (c) 2004-2007, 2009-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#ifndef SIMGRId_XBT_DYNAR_HPP -#define SIMGRId_XBT_DYNAR_HPP +#ifndef SIMGRID_XBT_DYNAR_HPP +#define SIMGRID_XBT_DYNAR_HPP #include - #include #include @@ -33,7 +32,14 @@ DynarRange range(xbt_dynar_t dynar) (T*) ((char*) dynar->data + dynar->used * dynar->elmsize)); } -} +/** Dynar of `T*` which `delete` its values */ +template inline +xbt_dynar_t newDeleteDynar() +{ + return xbt_dynar_new(sizeof(T*), + [](void* p) { delete *(T**)p; }); } +} +} #endif