forked from boostorg/fusion
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
/*=============================================================================
|
|
Copyright (c) 2001-2006 Joel de Guzman
|
|
|
|
Use, modification and distribution is subject to 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_IF_09162005_0137)
|
|
#define FUSION_COUNT_IF_09162005_0137
|
|
|
|
#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>
|
|
|
|
namespace boost { namespace fusion
|
|
{
|
|
namespace result_of
|
|
{
|
|
template <typename Sequence, typename F>
|
|
struct count_if
|
|
{
|
|
typedef int type;
|
|
};
|
|
}
|
|
|
|
template <typename Sequence, typename F>
|
|
inline int
|
|
count_if(Sequence const& seq, F f)
|
|
{
|
|
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>());
|
|
}
|
|
}}
|
|
|
|
#endif
|
|
|