From e82ddaed3896c42c63987da98f916f13a6af5e12 Mon Sep 17 00:00:00 2001 From: Tobias Schwinger Date: Mon, 19 Mar 2007 18:13:24 +0000 Subject: [PATCH] support for sequences weaker than Forward Sequence [SVN r37230] --- .../zip_view/detail/strictest_traversal.hpp | 33 +++++++++---------- .../sequence/view/zip_view/zip_view.hpp | 15 +++++++-- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/include/boost/fusion/sequence/view/zip_view/detail/strictest_traversal.hpp b/include/boost/fusion/sequence/view/zip_view/detail/strictest_traversal.hpp index 33ff347e..b6c43fa9 100644 --- a/include/boost/fusion/sequence/view/zip_view/detail/strictest_traversal.hpp +++ b/include/boost/fusion/sequence/view/zip_view/detail/strictest_traversal.hpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include namespace boost { namespace fusion { @@ -25,6 +25,19 @@ namespace boost { namespace fusion { namespace detail { + template::value> + struct stricter_traversal + { + typedef Tag1 type; + }; + + template + struct stricter_traversal + { + typedef Tag2 type; + }; + template struct strictest_traversal_impl { @@ -32,23 +45,7 @@ namespace boost { namespace fusion { typedef typename traits::category_of< typename remove_reference::type>::type tag2; - typedef typename mpl::or_< - is_same, - is_same >::type - has_forward_traversal; - - typedef typename mpl::or_< - is_same, - is_same >::type - has_bidirectional_traversal; - - typedef typename mpl::if_< - has_forward_traversal, - forward_traversal_tag, - typename mpl::if_< - has_bidirectional_traversal, - bidirectional_traversal_tag, - random_access_traversal_tag>::type>::type type; + typedef typename stricter_traversal::type type; }; template diff --git a/include/boost/fusion/sequence/view/zip_view/zip_view.hpp b/include/boost/fusion/sequence/view/zip_view/zip_view.hpp index f3bc5cd9..9668abed 100644 --- a/include/boost/fusion/sequence/view/zip_view/zip_view.hpp +++ b/include/boost/fusion/sequence/view/zip_view/zip_view.hpp @@ -47,10 +47,21 @@ namespace boost { namespace fusion { struct seq_ref_size { - template + template::type, + bool HasSize = traits::is_forward::value + > struct result - : result_of::size::type> + : result_of::size {}; + + static int const int_max = static_cast( + static_cast(~0) >> 1); + + template + struct result + : mpl::int_ + {}; }; struct poly_min