From 1d47ac26a8a02be0d076ce2ff4de02d7949dcb04 Mon Sep 17 00:00:00 2001 From: q66 Date: Sun, 7 Jun 2015 16:17:03 +0100 Subject: [PATCH] simplify func checks --- octa/algorithm.h | 65 +++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/octa/algorithm.h b/octa/algorithm.h index 32ddf74..580e4f7 100644 --- a/octa/algorithm.h +++ b/octa/algorithm.h @@ -428,7 +428,7 @@ namespace detail { template using MapLambdaArg = typename MapLambdaTypes::Arg; - template + template struct MapFuncTest { template static char test(MapLambdaRet (*)(MapLambdaArg)); @@ -437,37 +437,36 @@ namespace detail { static constexpr bool value = (sizeof(test(octa::declval())) == 1); }; - template::value - > struct MapFuncTypeObjBase { - typedef octa::Function)> Type; + template::value> + struct MapFuncTypeObjBase { + typedef octa::Function)> Type; }; - template - struct MapFuncTypeObjBase { + template + struct MapFuncTypeObjBase { typedef MapLambdaRet (*Type)(MapLambdaArg); }; - template::value && octa::IsMoveConstructible::value > struct MapFuncTypeObj { - typedef typename MapFuncTypeObjBase::Type Type; + typedef typename MapFuncTypeObjBase::Type Type; }; - template - struct MapFuncTypeObj { + template + struct MapFuncTypeObj { typedef F Type; }; - template::value> + template::value> struct MapFuncType { typedef F Type; }; - template - struct MapFuncType { - typedef typename MapFuncTypeObj::Type Type; + template + struct MapFuncType { + typedef typename MapFuncTypeObj::Type Type; }; } @@ -477,7 +476,7 @@ struct MapRange: InputRange< > { private: T p_range; - typename octa::detail::MapFuncType::Type p_func; + typename octa::detail::MapFuncType::Type p_func; public: MapRange(): p_range(), p_func() {} @@ -570,7 +569,7 @@ namespace detail { typedef A Type; }; - template + template struct FilterPredTest { template static char test(bool (*)(typename FilterLambdaArg::Type)); @@ -579,37 +578,35 @@ namespace detail { static constexpr bool value = (sizeof(test(octa::declval())) == 1); }; - template::value - > struct FilterPredTypeObjBase { - typedef octa::Function)> Type; + template::value> + struct FilterPredTypeObjBase { + typedef octa::Function::Type)> Type; }; - template - struct FilterPredTypeObjBase { + template + struct FilterPredTypeObjBase { typedef bool (*Type)(typename FilterLambdaArg::Type); }; - template::value && - octa::IsMoveConstructible::value + template::value && + octa::IsMoveConstructible::value > struct FilterPredTypeObj { - typedef typename FilterPredTypeObjBase::Type Type; + typedef typename FilterPredTypeObjBase::Type Type; }; - template - struct FilterPredTypeObj { + template + struct FilterPredTypeObj { typedef F Type; }; - template::value> + template::value> struct FilterPredType { typedef F Type; }; - template - struct FilterPredType { - typedef typename FilterPredTypeObj::Type Type; + template + struct FilterPredType { + typedef typename FilterPredTypeObj::Type Type; }; } @@ -621,7 +618,7 @@ struct FilterRange: InputRange< > { private: T p_range; - typename octa::detail::FilterPredType::Type p_pred; + typename octa::detail::FilterPredType::Type p_pred; void advance_valid() { while (!p_range.empty() && !p_pred(front())) p_range.pop_front();