remove \r
[extl.git] / extl / algorithm / find_all.h
blob0e5e1aad93aa59e05f402e3ec691132905caeb72
1 /* ///////////////////////////////////////////////////////////////////////
2 * File: find_all.h
4 * Created: 08.07.01
5 * Updated: 08.07.01
7 * Brief: The find_all and rfind_all functions
9 * [<Home>]
10 * Copyright (c) 2008-2020, Waruqi All rights reserved.
11 * //////////////////////////////////////////////////////////////////// */
13 #ifndef EXTL_ALGORITHM_FIND_ALL_H
14 #define EXTL_ALGORITHM_FIND_ALL_H
16 /*!\file find_all.h
17 * \brief The find_all and rfind_all functions
19 #ifndef __cplusplus
20 # error find_all.h need be supported by c++.
21 #endif
23 /* ///////////////////////////////////////////////////////////////////////
24 * Includes
26 #include "prefix.h"
27 #include "std\algorithm.h"
29 /* ///////////////////////////////////////////////////////////////////////
30 * ::extl namespace
32 EXTL_BEGIN_NAMESPACE
34 /* For compatibility.
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
48 /*!find_all
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);
58 /*!rfind_all
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);
68 /*!find_all_if
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);
78 /*!rfind_all_if
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 /* ///////////////////////////////////////////////////////////////////////
89 * ::extl namespace
91 EXTL_END_NAMESPACE
93 /* //////////////////////////////////////////////////////////////////// */
94 #endif /* EXTL_ALGORITHM_FIND_ALL_H */
95 /* //////////////////////////////////////////////////////////////////// */