mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-22 08:42:15 +02:00
find_if: Improved tag usage
The traversal tag is a bit complex than before.
This commit is contained in:
@ -22,10 +22,9 @@
|
|||||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||||
#include <boost/fusion/support/category_of.hpp>
|
#include <boost/fusion/support/category_of.hpp>
|
||||||
|
#include <boost/core/enable_if.hpp>
|
||||||
|
|
||||||
namespace boost { namespace fusion {
|
namespace boost { namespace fusion { namespace detail
|
||||||
struct random_access_traversal_tag;
|
|
||||||
namespace detail
|
|
||||||
{
|
{
|
||||||
template <typename Iterator, typename Pred>
|
template <typename Iterator, typename Pred>
|
||||||
struct apply_filter
|
struct apply_filter
|
||||||
@ -179,7 +178,7 @@ namespace detail
|
|||||||
First
|
First
|
||||||
, Last
|
, Last
|
||||||
, Pred
|
, Pred
|
||||||
, is_base_of<random_access_traversal_tag, typename traits::category_of<First>::type>::value
|
, traits::is_random_access<First>::value
|
||||||
>::type
|
>::type
|
||||||
type;
|
type;
|
||||||
|
|
||||||
@ -208,31 +207,23 @@ namespace detail
|
|||||||
return recursive_call(iter, found());
|
return recursive_call(iter, found());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Iterator, typename Tag>
|
template <typename Iterator>
|
||||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||||
static type
|
static typename boost::disable_if<traits::is_random_access<Iterator>, type>::type
|
||||||
choose_call(Iterator const& iter, Tag)
|
iter_call(Iterator const& iter)
|
||||||
{
|
{
|
||||||
return recursive_call(iter);
|
return recursive_call(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Iterator>
|
template <typename Iterator>
|
||||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||||
static type
|
static typename boost::enable_if<traits::is_random_access<Iterator>, type>::type
|
||||||
choose_call(Iterator const& iter, random_access_traversal_tag)
|
iter_call(Iterator const& iter)
|
||||||
{
|
{
|
||||||
typedef typename result_of::distance<Iterator, type>::type N;
|
typedef typename result_of::distance<Iterator, type>::type N;
|
||||||
return fusion::advance<N>(iter);
|
return fusion::advance<N>(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Iterator>
|
|
||||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
|
||||||
static type
|
|
||||||
iter_call(Iterator const& iter)
|
|
||||||
{
|
|
||||||
return choose_call(iter, typename traits::category_of<Iterator>::type());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Sequence>
|
template <typename Sequence>
|
||||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||||
static type
|
static type
|
||||||
|
Reference in New Issue
Block a user