diff --git a/sprout/functional/bind/bind.hpp b/sprout/functional/bind/bind.hpp index 6e4436b2..8e707f80 100644 --- a/sprout/functional/bind/bind.hpp +++ b/sprout/functional/bind/bind.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -683,47 +684,76 @@ namespace sprout { {}; namespace detail { - template - struct complete_placeholder; - template - struct complete_placeholder< - Index, BoundArg, - typename std::enable_if::value>::type - > { + template + struct complete_placeholder { public: typedef BoundArg type; }; - template + template struct complete_placeholder< - Index, BoundArg, + N, BoundArg, typename std::enable_if::value>::type > { public: - typedef sprout::placeholder type; + typedef sprout::placeholder type; }; - template - struct binder_complete_placeholders_impl; - template - struct binder_complete_placeholders_impl, BoundArgs...> { + template + struct binder_complete_placeholders_impl { public: - typedef sprout::binder::type...)> type; + typedef Binder type; }; + template + struct binder_complete_placeholders_impl< + I, N, Bounds, sprout::binder, + typename std::enable_if<(I < sprout::tuples::tuple_size::value)>::type + > + : public std::conditional< + sprout::is_positional_placeholder::type>::value, + sprout::detail::binder_complete_placeholders_impl< + I + 1, N + 1, Bounds, + sprout::binder)> + >, + sprout::detail::binder_complete_placeholders_impl< + I + 1, N, Bounds, + sprout::binder::type)> + > + >::type + {}; template struct binder_complete_placeholders - : public sprout::detail::binder_complete_placeholders_impl::type, BoundArgs...> + : public sprout::detail::binder_complete_placeholders_impl< + 0, 0, sprout::types::type_tuple, sprout::binder + > {}; - template - struct res_binder_complete_placeholders_impl; - template - struct res_binder_complete_placeholders_impl, BoundArgs...> { + template + struct res_binder_complete_placeholders_impl { public: - typedef sprout::res_binder::type...)> type; + typedef Binder type; }; + template + struct res_binder_complete_placeholders_impl< + I, N, Bounds, sprout::res_binder, + typename std::enable_if<(I < sprout::tuples::tuple_size::value)>::type + > + : public std::conditional< + sprout::is_positional_placeholder::type>::value, + sprout::detail::res_binder_complete_placeholders_impl< + I + 1, N + 1, Bounds, + sprout::res_binder)> + >, + sprout::detail::res_binder_complete_placeholders_impl< + I + 1, N, Bounds, + sprout::res_binder::type)> + > + >::type + {}; template struct res_binder_complete_placeholders - : public sprout::detail::res_binder_complete_placeholders_impl::type, BoundArgs...> + : public sprout::detail::res_binder_complete_placeholders_impl< + 0, 0, sprout::types::type_tuple, sprout::res_binder + > {}; template diff --git a/sprout/type/algorithm/lower_bound_index.hpp b/sprout/type/algorithm/lower_bound_index.hpp index 79a0e341..0f21056d 100644 --- a/sprout/type/algorithm/lower_bound_index.hpp +++ b/sprout/type/algorithm/lower_bound_index.hpp @@ -29,6 +29,8 @@ namespace sprout { // // lower_bound_index // + // TODO: O(log N) implementation + // template struct lower_bound_index : public sprout::types::detail::lower_bound_index_impl<0, Tuple, T, Compare>