/usr/include/xbt/dynar.hpp is in libsimgrid-dev 3.18+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | /* 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
#include <boost/range/iterator_range.hpp>
#include <xbt/asserts.h>
#include <xbt/dynar.h>
namespace simgrid {
namespace xbt {
/** A C++ range from a a dynar */
template<class T>
using DynarRange = boost::iterator_range<T*>;
/** Create an iterator range representing a dynar
*
* C++ range loops for `xbt_dynar_t`:
*
* <code>for (auto& x : range<double>(some_dynar)) ++x;</code>
*/
template<class T> inline
DynarRange<T> range(xbt_dynar_t dynar)
{
xbt_assert(dynar->elmsize == sizeof(T));
return DynarRange<T>((T*) dynar->data,
(T*) ((char*) dynar->data + dynar->used * dynar->elmsize));
}
/** Dynar of `T*` which `delete` its values */
template<class T> inline
xbt_dynar_t newDeleteDynar()
{
return xbt_dynar_new(sizeof(T*),
[](void* p) { delete *(T**)p; });
}
}
}
#endif
|