1 /* ///////////////////////////////////////////////////////////////////////
7 * Brief: The find_all and rfind_all functions
10 * Copyright (c) 2008-2020, Waruqi All rights reserved.
11 * //////////////////////////////////////////////////////////////////// */
13 #ifndef EXTL_ALGORITHM_FIND_ALL_H
14 #define EXTL_ALGORITHM_FIND_ALL_H
17 * \brief The find_all and rfind_all functions
20 # error find_all.h need be supported by c++.
23 /* ///////////////////////////////////////////////////////////////////////
27 #include "std\algorithm.h"
29 /* ///////////////////////////////////////////////////////////////////////
35 * WATCOM need return container_traits<C>::const_iterator instead of C::const_iterator
37 EXTL_DETAIL_BEGIN_NAMESPACE
38 template <typename_param_k C
>
39 struct container_traits
41 typedef typename_type_k
C::iterator iterator
;
42 typedef typename_type_k
C::const_iterator const_iterator
;
43 typedef typename_type_k
C::reverse_iterator reverse_iterator
;
44 typedef typename_type_k
C::const_reverse_iterator const_reverse_iterator
;
46 EXTL_DETAIL_END_NAMESPACE
50 * \ingroup extl_group_algorithm
52 template<typename_param_k C
, typename_param_k Val
>
53 EXTL_INLINE typename_type_ret_k
EXTL_NS_DETAIL(container_traits
)<C
>::
54 const_iterator
find_all(C
const& container
, Val
const& value
)
56 return std_find(container
.begin(), container
.end(), value
);
60 * \ingroup extl_group_algorithm
62 template<typename_param_k C
, typename_param_k Val
>
63 EXTL_INLINE typename_type_ret_k
EXTL_NS_DETAIL(container_traits
)<C
>::
64 const_reverse_iterator
rfind_all(C
const& container
, Val
const& value
)
66 return std_find(container
.rbegin(), container
.rend(), value
);
70 * \ingroup extl_group_algorithm
72 template<typename_param_k C
, typename_param_k Pr
>
73 EXTL_INLINE typename_type_ret_k
EXTL_NS_DETAIL(container_traits
)<C
>::
74 const_iterator
find_all_if(C
const& container
, Pr pred
)
76 return std_find_if(container
.begin(), container
.end(), pred
);
80 * \ingroup extl_group_algorithm
82 template<typename_param_k C
, typename_param_k Pr
>
83 EXTL_INLINE typename_type_ret_k
EXTL_NS_DETAIL(container_traits
)<C
>::
84 const_reverse_iterator
rfind_all_if(C
const& container
, Pr pred
)
86 return std_find_if(container
.rbegin(), container
.rend(), pred
);
88 /* ///////////////////////////////////////////////////////////////////////
93 /* //////////////////////////////////////////////////////////////////// */
94 #endif /* EXTL_ALGORITHM_FIND_ALL_H */
95 /* //////////////////////////////////////////////////////////////////// */