Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
template<typename InputIterable, typename ResultIterable, typename Less>
bool check_sort_property(InputIterable const& input,
ResultIterable const& result,
Less less)
{
return
std::is_permutation(begin(input), end(input), begin(result), end(result))
&& std::is_sorted(begin(result), end(result), less);
}
template<typename InputIterable, typename ResultIterable>
bool check_sort_property(InputIterable const& input,
ResultIterable const& result)
{
auto less = std::less<typename InputIterable::value_type>();
return check_sort_property(input, result, less);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment