From 8943b2e30f8275619df0cf89f1e8ebc7deb58ca5 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 17 Jan 2015 22:48:39 +0100 Subject: Replaced `If` based `Nth` implementation with partial specializations * partial specializations offer control over lazy type instantiation ** `If` is currently only a `std::conditional` wrapper and requires further refinement to be really useful for this kind of use case --- src/list/operation/basic.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/list') diff --git a/src/list/operation/basic.h b/src/list/operation/basic.h index dbd080e..586cf2f 100644 --- a/src/list/operation/basic.h +++ b/src/list/operation/basic.h @@ -2,7 +2,6 @@ #define TYPEASVALUE_SRC_LIST_OPERATION_BASIC_H_ #include "operation/math.h" -#include "conditional/if.h" namespace tav { @@ -24,14 +23,10 @@ template < typename Cons > struct Nth { - typedef If< - equal_value>::value, - Head, - typename Nth< - Substract>, - Tail - >::type - > type; + typedef typename Nth< + Substract>, + Tail + >::type type; }; template @@ -39,6 +34,11 @@ struct Nth { typedef void type; }; +template +struct Nth, Cons> { + typedef Head type; +}; + template < typename Count, typename Current -- cgit v1.2.3