/ska_sort

Sorting in less than O(n log n)

Primary LanguageC++Boost Software License 1.0BSL-1.0

Introduction

ska::sort is an in-place radix sort, implemented as a C++14 header-only library using templates.

Usage

For a vector of a basic type, just pass two iterators:

ska::sort(durations.begin(), durations.end());

For a more complicated situation, provide a lambda that returns a key to sort on:

ska::sort(enemies.begin(), enemies.end(), [](const Enemey & enemy)
{
    return std::make_tuple(!is_in_combat(enemy), distance_to_player(enemy));
});

Check references for more examples.

License

Boost Software License - Version 1.0

References