diff options
author | Adrian Kummerlaender | 2015-02-15 14:07:50 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-02-15 14:07:50 +0100 |
commit | 46e174935b122c0da4b51532a7f683a512eeaf65 (patch) | |
tree | 88bed0d869ce40c460e6370b4954ff159fe3c575 /src/list/operation/nth.h | |
parent | e24f25ada7e8f48dc35cb235e045a4324bccb4f2 (diff) | |
download | TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.gz TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.bz2 TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.lz TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.xz TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.zst TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.zip |
Moved class-based implementations into `detail` namespace
* while class templates enable e.g. hiding implementation details they also require evaluation via `Eval`
** this clutters up the actual logic and is now hidden behind aliae that perform the evaluation
Diffstat (limited to 'src/list/operation/nth.h')
-rw-r--r-- | src/list/operation/nth.h | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/list/operation/nth.h b/src/list/operation/nth.h index 08e60cc..5a604f4 100644 --- a/src/list/operation/nth.h +++ b/src/list/operation/nth.h @@ -5,20 +5,22 @@ namespace tav { +namespace detail { + template < typename Index, - typename Pair + typename List > struct Nth { typedef Eval<Nth< Substract<Index, Size<1>>, - Tail<Pair> + Tail<List> >> type; }; -template <typename Pair> -struct Nth<Size<0>, Pair> { - typedef Head<Pair> type; +template <typename List> +struct Nth<Size<0>, List> { + typedef Head<List> type; }; template <typename Index> @@ -31,14 +33,22 @@ struct Nth<Size<0>, void> { typedef void type; }; +} + +template < + typename Index, + typename List +> +using Nth = Eval<detail::Nth<Index, List>>; + template <typename List> -using First = Eval<Nth<Size<0>, List>>; +using First = Nth<Size<0>, List>; template <typename List> -using Second = Eval<Nth<Size<1>, List>>; +using Second = Nth<Size<1>, List>; template <typename List> -using Third = Eval<Nth<Size<2>, List>>; +using Third = Nth<Size<2>, List>; } |