From d2666c49067a3e25b5fa42a49b81cf8cc629ab78 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 12 Apr 2018 22:00:22 +0200 Subject: [PATCH] Kill unused DynarRange; move newDeleteDynar() in dynar.h. --- include/xbt/dynar.h | 12 +++++ include/xbt/dynar.hpp | 45 ------------------- .../CommunicationDeterminismChecker.cpp | 1 - src/mc/checker/LivenessChecker.cpp | 1 - src/mc/mc_comm_pattern.cpp | 1 - tools/cmake/DefinePackages.cmake | 1 - 6 files changed, 12 insertions(+), 49 deletions(-) delete mode 100644 include/xbt/dynar.hpp diff --git a/include/xbt/dynar.h b/include/xbt/dynar.h index 52a99e05b9..095187f380 100644 --- a/include/xbt/dynar.h +++ b/include/xbt/dynar.h @@ -260,4 +260,16 @@ xbt_dynar_foreach (dyn,cpt,str) { /** @} */ SG_END_DECL() +#ifdef __cplusplus +namespace simgrid { +namespace xbt { +/** 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 + #endif /* XBT_DYNAR_H */ 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 diff --git a/src/mc/checker/CommunicationDeterminismChecker.cpp b/src/mc/checker/CommunicationDeterminismChecker.cpp index db4a3d3b48..68836c628c 100644 --- a/src/mc/checker/CommunicationDeterminismChecker.cpp +++ b/src/mc/checker/CommunicationDeterminismChecker.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include diff --git a/src/mc/checker/LivenessChecker.cpp b/src/mc/checker/LivenessChecker.cpp index 23f8513365..8d87f5b445 100644 --- a/src/mc/checker/LivenessChecker.cpp +++ b/src/mc/checker/LivenessChecker.cpp @@ -15,7 +15,6 @@ #include #include -#include #include #include diff --git a/src/mc/mc_comm_pattern.cpp b/src/mc/mc_comm_pattern.cpp index 32f6e57c9e..3bcefee5c5 100644 --- a/src/mc/mc_comm_pattern.cpp +++ b/src/mc/mc_comm_pattern.cpp @@ -7,7 +7,6 @@ #include "xbt/dynar.h" #include "xbt/sysdep.h" -#include #include "src/mc/checker/CommunicationDeterminismChecker.hpp" #include "src/mc/mc_comm_pattern.hpp" diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index aea9490209..2650faf330 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -732,7 +732,6 @@ set(headers_to_install include/xbt/cunit.h include/xbt/dict.h include/xbt/dynar.h - include/xbt/dynar.hpp include/xbt/ex.h include/xbt/ex.hpp include/xbt/exception.hpp -- 2.20.1