diff --git a/algorithms_task_6/student/include/impl.h b/algorithms_task_6/student/include/impl.h index 104a3cec..a81655a8 100644 --- a/algorithms_task_6/student/include/impl.h +++ b/algorithms_task_6/student/include/impl.h @@ -1,6 +1,16 @@ #pragma once #include +#include +template +void stable_sort(Container& target) { + std::stable_sort(target.begin(), target.end()); +} + +template +void stable_sort(std::list& target) { + target.sort(); +} /** * @todo insert_to_sorted @@ -18,4 +28,7 @@ void insert_to_sorted(Sequence& target, const FwIt sourceBegin, const FwIt sourc static_assert(std::is_const::reference>::type>::value, "FwIt must point to const data"); + + std::copy(sourceBegin, sourceEnd, std::back_inserter(target)); + stable_sort(target); }