fix unfold

fix pair tuple support
This commit is contained in:
bolero-MURAKAMI 2012-09-28 16:05:09 +09:00
parent b1b7a9fefc
commit 06f1933220
3 changed files with 7 additions and 10 deletions

View file

@ -65,9 +65,7 @@ namespace sprout {
) )
{ {
return size > 0 return size > 0
? size > 1 ? sprout::fixed::detail::unfold_impl_1(cont, gen, gen(init), size)
? sprout::fixed::detail::unfold_impl_1(cont, gen, gen(init), size, init)
: sprout::detail::container_complate(cont, init)
: sprout::detail::container_complate(cont) : sprout::detail::container_complate(cont)
; ;
} }

View file

@ -214,21 +214,20 @@ namespace sprout {
template<typename T1, typename T2> template<typename T1, typename T2>
struct get_impl<0, sprout::pair<T1, T2> > { struct get_impl<0, sprout::pair<T1, T2> > {
public: public:
T1& operator()(sprout::pair<T1, T2>& t) const { SPROUT_CONSTEXPR T1& operator()(sprout::pair<T1, T2>& t) const {
return t.first; return t.first;
} }
T1 const& operator()(sprout::pair<T1, T2> const& t) const { SPROUT_CONSTEXPR T1 const& operator()(sprout::pair<T1, T2> const& t) const {
return t.first; return t.first;
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct get_impl<1, sprout::pair<T1, T2> > { struct get_impl<1, sprout::pair<T1, T2> > {
public: public:
public: SPROUT_CONSTEXPR T2& operator()(sprout::pair<T1, T2>& t) const {
T2& operator()(sprout::pair<T1, T2>& t) const {
return t.second; return t.second;
} }
T2 const& operator()(sprout::pair<T1, T2> const& t) const { SPROUT_CONSTEXPR T2 const& operator()(sprout::pair<T1, T2> const& t) const {
return t.second; return t.second;
} }
}; };

View file

@ -187,10 +187,10 @@ namespace testspr {
T val; T val;
public: public:
SPROUT_CONSTEXPR T const& generated_value() const { return val; } 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: public:
SPROUT_CONSTEXPR result operator()(T const& val) const { return result{val + 1}; } SPROUT_CONSTEXPR result operator()(T const& val) const { return result{val}; }
}; };
// //