X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5ee69f22d5f6ab219b59132ade49e92978ecdc21..d2666c49067a3e25b5fa42a49b81cf8cc629ab78:/include/xbt/dynar.hpp diff --git a/include/xbt/dynar.hpp b/include/xbt/dynar.hpp deleted file mode 100644 index 84fe5a2734..0000000000 --- a/include/xbt/dynar.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2004-2018. 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 - -#include -#include -#include - -namespace simgrid { -namespace xbt { - -/** A C++ range from a a dynar */ -template -using DynarRange = boost::iterator_range; - -/** Create an iterator range representing a dynar - * - * C++ range loops for `xbt_dynar_t`: - * - * for (auto& x : range(some_dynar)) ++x; - */ -template inline -DynarRange range(xbt_dynar_t dynar) -{ - xbt_assert(dynar->elmsize == sizeof(T)); - return DynarRange((T*) dynar->data, - (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