#ifndef TYPEASVALUE_SRC_LIST_OPERATION_BASIC_H_ #define TYPEASVALUE_SRC_LIST_OPERATION_BASIC_H_ #include "operation/math.h" #include "higher/fold.h" namespace tav { template class Length { private: template < typename, typename Current > struct Count { typedef Add, Current> type; }; public: typedef typename Fold, Cons>::type type; }; template < typename Index, typename Cons > struct Nth { typedef typename Nth< Substract>, Tail >::type type; }; template struct Nth { typedef void type; }; template struct Nth, Cons> { typedef Head type; }; template < typename Count, typename Current > struct Take { typedef Cons< Head, typename Take< Substract>, Tail >::type > type; }; template struct Take, Current> { typedef void type; }; template struct Take { typedef void type; }; template <> struct Take, void> { typedef void type; }; } #endif // TYPEASVALUE_SRC_LIST_OPERATION_BASIC_H_