From 06f1933220208d2fbaca5b3887389d42a80b5823 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Fri, 28 Sep 2012 16:05:09 +0900 Subject: [PATCH] fix unfold fix pair tuple support --- sprout/algorithm/fixed/unfold.hpp | 4 +--- sprout/utility/pair.hpp | 9 ++++----- testspr/tools.hpp | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/sprout/algorithm/fixed/unfold.hpp b/sprout/algorithm/fixed/unfold.hpp index 10bd013f..871ec2b3 100644 --- a/sprout/algorithm/fixed/unfold.hpp +++ b/sprout/algorithm/fixed/unfold.hpp @@ -65,9 +65,7 @@ namespace sprout { ) { return size > 0 - ? size > 1 - ? sprout::fixed::detail::unfold_impl_1(cont, gen, gen(init), size, init) - : sprout::detail::container_complate(cont, init) + ? sprout::fixed::detail::unfold_impl_1(cont, gen, gen(init), size) : sprout::detail::container_complate(cont) ; } diff --git a/sprout/utility/pair.hpp b/sprout/utility/pair.hpp index 6c0eb7d3..cfa36345 100644 --- a/sprout/utility/pair.hpp +++ b/sprout/utility/pair.hpp @@ -214,21 +214,20 @@ namespace sprout { template struct get_impl<0, sprout::pair > { public: - T1& operator()(sprout::pair& t) const { + SPROUT_CONSTEXPR T1& operator()(sprout::pair& t) const { return t.first; } - T1 const& operator()(sprout::pair const& t) const { + SPROUT_CONSTEXPR T1 const& operator()(sprout::pair const& t) const { return t.first; } }; template struct get_impl<1, sprout::pair > { public: - public: - T2& operator()(sprout::pair& t) const { + SPROUT_CONSTEXPR T2& operator()(sprout::pair& t) const { return t.second; } - T2 const& operator()(sprout::pair const& t) const { + SPROUT_CONSTEXPR T2 const& operator()(sprout::pair const& t) const { return t.second; } }; diff --git a/testspr/tools.hpp b/testspr/tools.hpp index e7b5ca59..94fd261a 100644 --- a/testspr/tools.hpp +++ b/testspr/tools.hpp @@ -187,10 +187,10 @@ namespace testspr { T val; public: SPROUT_CONSTEXPR T const& generated_value() const { return val; } - SPROUT_CONSTEXPR T const& next_generator() const { return val; } + SPROUT_CONSTEXPR T next_generator() const { return val + 1; } }; public: - SPROUT_CONSTEXPR result operator()(T const& val) const { return result{val + 1}; } + SPROUT_CONSTEXPR result operator()(T const& val) const { return result{val}; } }; //