/usr/include/osl/misc/reorder.h is in libosl-dev 0.6.0-3.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 | /* reorder.h
*/
#ifndef OSL_MISC_REORDER_H
#define OSL_MISC_REORDER_H
#include <algorithm>
namespace osl
{
namespace misc
{
struct Reorder
{
/** first から last を indices に書かれて順番で並べ変える */
template <class RandomIterator, class OrderArray>
static void reorder(RandomIterator first, RandomIterator last,
const OrderArray& indices)
{
const int size = last - first;
for (int i=0; i<size-1; ++i) // we do not need to swap the last one
{
int swap_target = indices[i];
while (swap_target < i)
swap_target = indices[swap_target];
std::swap(*(first+i), *(first+swap_target));
}
}
};
}
}
#endif /* OSL_MISC_REORDER_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|