diff options
author | Adrian Kummerlaender | 2015-02-16 16:35:38 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-02-16 16:35:38 +0100 |
commit | 5a9366307d23b220657629c494827def3544c490 (patch) | |
tree | a9ca13de33d1098a4b02755c0c29435d146cdb8f | |
parent | 45c63c95293e42860ee17368ab24cc65cc60d378 (diff) | |
download | TypeAsValue-5a9366307d23b220657629c494827def3544c490.tar TypeAsValue-5a9366307d23b220657629c494827def3544c490.tar.gz TypeAsValue-5a9366307d23b220657629c494827def3544c490.tar.bz2 TypeAsValue-5a9366307d23b220657629c494827def3544c490.tar.lz TypeAsValue-5a9366307d23b220657629c494827def3544c490.tar.xz TypeAsValue-5a9366307d23b220657629c494827def3544c490.tar.zst TypeAsValue-5a9366307d23b220657629c494827def3544c490.zip |
Renamed `detail::Sort` to `detail::quick_sort`
* opens up the possibility of implementing different sort algorithms in this library
* removed now unnecessary namespace prefixes
-rw-r--r-- | src/list/list.h | 1 | ||||
-rw-r--r-- | src/list/operation/higher/sort.h | 18 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/list/list.h b/src/list/list.h index 1a4c260..edb52ec 100644 --- a/src/list/list.h +++ b/src/list/list.h @@ -1,6 +1,7 @@ #ifndef TYPEASVALUE_SRC_LIST_LIST_H_ #define TYPEASVALUE_SRC_LIST_LIST_H_ +#include "type.h" #include "cons.h" #include "detail/fold_variadic.h" diff --git a/src/list/operation/higher/sort.h b/src/list/operation/higher/sort.h index 26d99e6..925ab89 100644 --- a/src/list/operation/higher/sort.h +++ b/src/list/operation/higher/sort.h @@ -14,31 +14,31 @@ template < template<typename, typename> class Comparator, typename Sequence > -class Sort { +class quick_sort { private: - using index = Divide<tav::Length<Sequence>, Size<2>>; - using pivot = tav::Nth<index, Sequence>; + using index = Divide<Length<Sequence>, Size<2>>; + using pivot = Nth<index, Sequence>; using partitions = Partition< Apply<Comparator, pivot, _0>::template function, DeleteNth<index, Sequence> >; - using lhs = tav::Car<partitions>; - using rhs = tav::Cdr<partitions>; + using lhs = Car<partitions>; + using rhs = Cdr<partitions>; public: using type = Concatenate< List< - Eval<Sort<Comparator, lhs>>, + Eval<quick_sort<Comparator, lhs>>, List<pivot>, - Eval<Sort<Comparator, rhs>> + Eval<quick_sort<Comparator, rhs>> > >; }; template <template<typename, typename> class Comparator> -struct Sort<Comparator, void> { +struct quick_sort<Comparator, void> { typedef void type; }; @@ -48,7 +48,7 @@ template < template<typename, typename> class Comparator, typename Sequence > -using Sort = Eval<detail::Sort<Comparator, Sequence>>; +using Sort = Eval<detail::quick_sort<Comparator, Sequence>>; } |