From 262806540c6eaf0dc45794cdf8f5f0404df10c79 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 9 Feb 2015 15:44:46 +0100 Subject: Added `First`, `Second` and `Third` aliae for `Nth` * increases expressiveness in some contexts * renamed `Partition` list template parameter to avoid confusion --- src/list/operation/higher/partition.h | 6 +++--- src/list/operation/nth.h | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'src/list') diff --git a/src/list/operation/higher/partition.h b/src/list/operation/higher/partition.h index a0ea379..aed0ea6 100644 --- a/src/list/operation/higher/partition.h +++ b/src/list/operation/higher/partition.h @@ -7,11 +7,11 @@ namespace tav { template < template class Predicate, - typename List + typename Elements > using Partition = Cons< - typename Filter::type, - typename Remove::type + typename Filter::type, + typename Remove::type >; } diff --git a/src/list/operation/nth.h b/src/list/operation/nth.h index 6020dcb..076add4 100644 --- a/src/list/operation/nth.h +++ b/src/list/operation/nth.h @@ -26,6 +26,20 @@ struct Nth { typedef void type; }; +template <> +struct Nth, void> { + typedef void type; +}; + +template +using First = typename Nth, List>::type; + +template +using Second = typename Nth, List>::type; + +template +using Third = typename Nth, List>::type; + } #endif // TYPEASVALUE_SRC_LIST_OPERATION_NTH_H_ -- cgit v1.2.3