1 /* ///////////////////////////////////////////////////////////////////////
7 * Brief: The find functions
10 * Copyright (c) 2008-2020, Waruqi All rights reserved.
11 * //////////////////////////////////////////////////////////////////// */
13 #ifndef EXTL_ALGORITHM_FIND_H
14 #define EXTL_ALGORITHM_FIND_H
17 * \brief The find functions
20 # error find.h need be supported by c++.
23 /* ///////////////////////////////////////////////////////////////////////
27 #include "std/algorithm.h"
28 #include "detail/container_traits.h"
29 /* ///////////////////////////////////////////////////////////////////////
36 * \ingroup extl_group_algorithm
38 template<typename_param_k InIt
, typename_param_k Val
>
39 EXTL_INLINE InIt
xtl_find(InIt first
, InIt last
, Val
const& value
)
41 return std_find(first
, last
, value
);
45 * \ingroup extl_group_algorithm
47 template<typename_param_k InIt
, typename_param_k Pr
>
48 EXTL_INLINE InIt
xtl_find_if(InIt first
, InIt last
, Pr pred
)
50 return std_find_if(first
, last
, pred
);
55 * \ingroup extl_group_algorithm
57 template<typename_param_k C
, typename_param_k Val
>
58 EXTL_INLINE typename_type_ret_k
EXTL_NS_DETAIL(container_traits
)<C
>::
59 const_iterator
find_all(C
const& container
, Val
const& value
)
61 return xtl_find(container
.begin(), container
.end(), value
);
65 * \ingroup extl_group_algorithm
67 template<typename_param_k C
, typename_param_k Val
>
68 EXTL_INLINE typename_type_ret_k
EXTL_NS_DETAIL(container_traits
)<C
>::
69 const_reverse_iterator
rfind_all(C
const& container
, Val
const& value
)
71 return xtl_find(container
.rbegin(), container
.rend(), value
);
75 * \ingroup extl_group_algorithm
77 template<typename_param_k C
, typename_param_k Pr
>
78 EXTL_INLINE typename_type_ret_k
EXTL_NS_DETAIL(container_traits
)<C
>::
79 const_iterator
find_all_if(C
const& container
, Pr pred
)
81 return xtl_find_if(container
.begin(), container
.end(), pred
);
85 * \ingroup extl_group_algorithm
87 template<typename_param_k C
, typename_param_k Pr
>
88 EXTL_INLINE typename_type_ret_k
EXTL_NS_DETAIL(container_traits
)<C
>::
89 const_reverse_iterator
rfind_all_if(C
const& container
, Pr pred
)
91 return xtl_find_if(container
.rbegin(), container
.rend(), pred
);
94 /* ///////////////////////////////////////////////////////////////////////
99 /* //////////////////////////////////////////////////////////////////// */
100 #endif /* EXTL_ALGORITHM_FIND_H */
101 /* //////////////////////////////////////////////////////////////////// */