loop unrolling count(_if)

[SVN r37875]
This commit is contained in:
Dan Marsden
2007-06-02 21:48:14 +00:00
parent b33ce64895
commit 40524cfda1
3 changed files with 146 additions and 34 deletions

View File

@ -1,19 +1,15 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2007
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_COUNT_09162005_0150)
#define FUSION_COUNT_09162005_0150
#if !defined(BOOST_FUSION_COUNT_09162005_0150)
#define BOOST_FUSION_COUNT_09162005_0150
#include <boost/fusion/support/detail/as_fusion_element.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/algorithm/query/detail/count_if.hpp>
#include <boost/fusion/algorithm/query/count_if.hpp>
#include <boost/fusion/algorithm/query/detail/count.hpp>
#include <boost/fusion/support/detail/access.hpp>
namespace boost { namespace fusion
{
@ -31,13 +27,7 @@ namespace boost { namespace fusion
count(Sequence const& seq, T const& x)
{
detail::count_compare<T> f(x);
return detail::count_if(
fusion::begin(seq)
, fusion::end(seq)
, f
, result_of::equal_to<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type>());
return fusion::count_if(seq, f);
}
}}