Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / algorithm / string / predicate.hpp @ 2486

History | View | Annotate | Download (16.9 kB)

1 2486 sjacqu01
//  Boost string_algo library predicate.hpp header file  ---------------------------//
2 2486 sjacqu01
3 2486 sjacqu01
//  Copyright Pavol Droba 2002-2003.
4 2486 sjacqu01
//
5 2486 sjacqu01
// Distributed under the Boost Software License, Version 1.0.
6 2486 sjacqu01
//    (See accompanying file LICENSE_1_0.txt or copy at
7 2486 sjacqu01
//          http://www.boost.org/LICENSE_1_0.txt)
8 2486 sjacqu01
9 2486 sjacqu01
//  See http://www.boost.org/ for updates, documentation, and revision history.
10 2486 sjacqu01
11 2486 sjacqu01
#ifndef BOOST_STRING_PREDICATE_HPP
12 2486 sjacqu01
#define BOOST_STRING_PREDICATE_HPP
13 2486 sjacqu01
14 2486 sjacqu01
#include <boost/algorithm/string/config.hpp>
15 2486 sjacqu01
#include <boost/range/begin.hpp>
16 2486 sjacqu01
#include <boost/range/end.hpp>
17 2486 sjacqu01
#include <boost/range/iterator.hpp>
18 2486 sjacqu01
#include <boost/range/const_iterator.hpp>
19 2486 sjacqu01
#include <boost/range/as_literal.hpp>
20 2486 sjacqu01
#include <boost/range/iterator_range_core.hpp>
21 2486 sjacqu01
22 2486 sjacqu01
#include <boost/algorithm/string/compare.hpp>
23 2486 sjacqu01
#include <boost/algorithm/string/find.hpp>
24 2486 sjacqu01
#include <boost/algorithm/string/detail/predicate.hpp>
25 2486 sjacqu01
26 2486 sjacqu01
/*! \file boost/algorithm/string/predicate.hpp
27 2486 sjacqu01
    Defines string-related predicates.
28 2486 sjacqu01
    The predicates determine whether a substring is contained in the input string
29 2486 sjacqu01
    under various conditions: a string starts with the substring, ends with the
30 2486 sjacqu01
    substring, simply contains the substring or if both strings are equal.
31 2486 sjacqu01
    Additionaly the algorithm \c all() checks all elements of a container to satisfy a
32 2486 sjacqu01
    condition.
33 2486 sjacqu01

34 2486 sjacqu01
    All predicates provide the strong exception guarantee.
35 2486 sjacqu01
*/
36 2486 sjacqu01
37 2486 sjacqu01
namespace boost {
38 2486 sjacqu01
    namespace algorithm {
39 2486 sjacqu01
40 2486 sjacqu01
//  starts_with predicate  -----------------------------------------------//
41 2486 sjacqu01
42 2486 sjacqu01
        //! 'Starts with' predicate
43 2486 sjacqu01
        /*!
44 2486 sjacqu01
            This predicate holds when the test string is a prefix of the Input.
45 2486 sjacqu01
            In other words, if the input starts with the test.
46 2486 sjacqu01
            When the optional predicate is specified, it is used for character-wise
47 2486 sjacqu01
            comparison.
48 2486 sjacqu01

49 2486 sjacqu01
            \param Input An input sequence
50 2486 sjacqu01
            \param Test A test sequence
51 2486 sjacqu01
            \param Comp An element comparison predicate
52 2486 sjacqu01
            \return The result of the test
53 2486 sjacqu01

54 2486 sjacqu01
              \note This function provides the strong exception-safety guarantee
55 2486 sjacqu01
        */
56 2486 sjacqu01
        template<typename Range1T, typename Range2T, typename PredicateT>
57 2486 sjacqu01
            inline bool starts_with(
58 2486 sjacqu01
            const Range1T& Input,
59 2486 sjacqu01
            const Range2T& Test,
60 2486 sjacqu01
            PredicateT Comp)
61 2486 sjacqu01
        {
62 2486 sjacqu01
            iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range1T>::type> lit_input(::boost::as_literal(Input));
63 2486 sjacqu01
            iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range2T>::type> lit_test(::boost::as_literal(Test));
64 2486 sjacqu01
65 2486 sjacqu01
            typedef BOOST_STRING_TYPENAME
66 2486 sjacqu01
                range_const_iterator<Range1T>::type Iterator1T;
67 2486 sjacqu01
            typedef BOOST_STRING_TYPENAME
68 2486 sjacqu01
                range_const_iterator<Range2T>::type Iterator2T;
69 2486 sjacqu01
70 2486 sjacqu01
            Iterator1T InputEnd=::boost::end(lit_input);
71 2486 sjacqu01
            Iterator2T TestEnd=::boost::end(lit_test);
72 2486 sjacqu01
73 2486 sjacqu01
            Iterator1T it=::boost::begin(lit_input);
74 2486 sjacqu01
            Iterator2T pit=::boost::begin(lit_test);
75 2486 sjacqu01
            for(;
76 2486 sjacqu01
                it!=InputEnd && pit!=TestEnd;
77 2486 sjacqu01
                ++it,++pit)
78 2486 sjacqu01
            {
79 2486 sjacqu01
                if( !(Comp(*it,*pit)) )
80 2486 sjacqu01
                    return false;
81 2486 sjacqu01
            }
82 2486 sjacqu01
83 2486 sjacqu01
            return pit==TestEnd;
84 2486 sjacqu01
        }
85 2486 sjacqu01
86 2486 sjacqu01
        //! 'Starts with' predicate
87 2486 sjacqu01
        /*!
88 2486 sjacqu01
            \overload
89 2486 sjacqu01
        */
90 2486 sjacqu01
        template<typename Range1T, typename Range2T>
91 2486 sjacqu01
        inline bool starts_with(
92 2486 sjacqu01
            const Range1T& Input,
93 2486 sjacqu01
            const Range2T& Test)
94 2486 sjacqu01
        {
95 2486 sjacqu01
            return ::boost::algorithm::starts_with(Input, Test, is_equal());
96 2486 sjacqu01
        }
97 2486 sjacqu01
98 2486 sjacqu01
        //! 'Starts with' predicate ( case insensitive )
99 2486 sjacqu01
        /*!
100 2486 sjacqu01
            This predicate holds when the test string is a prefix of the Input.
101 2486 sjacqu01
            In other words, if the input starts with the test.
102 2486 sjacqu01
            Elements are compared case insensitively.
103 2486 sjacqu01

104 2486 sjacqu01
            \param Input An input sequence
105 2486 sjacqu01
            \param Test A test sequence
106 2486 sjacqu01
            \param Loc A locale used for case insensitive comparison
107 2486 sjacqu01
            \return The result of the test
108 2486 sjacqu01

109 2486 sjacqu01
            \note This function provides the strong exception-safety guarantee
110 2486 sjacqu01
        */
111 2486 sjacqu01
        template<typename Range1T, typename Range2T>
112 2486 sjacqu01
        inline bool istarts_with(
113 2486 sjacqu01
            const Range1T& Input,
114 2486 sjacqu01
            const Range2T& Test,
115 2486 sjacqu01
            const std::locale& Loc=std::locale())
116 2486 sjacqu01
        {
117 2486 sjacqu01
            return ::boost::algorithm::starts_with(Input, Test, is_iequal(Loc));
118 2486 sjacqu01
        }
119 2486 sjacqu01
120 2486 sjacqu01
121 2486 sjacqu01
//  ends_with predicate  -----------------------------------------------//
122 2486 sjacqu01
123 2486 sjacqu01
        //! 'Ends with' predicate
124 2486 sjacqu01
        /*!
125 2486 sjacqu01
            This predicate holds when the test string is a suffix of the Input.
126 2486 sjacqu01
            In other words, if the input ends with the test.
127 2486 sjacqu01
            When the optional predicate is specified, it is used for character-wise
128 2486 sjacqu01
            comparison.
129 2486 sjacqu01

130 2486 sjacqu01

131 2486 sjacqu01
            \param Input An input sequence
132 2486 sjacqu01
            \param Test A test sequence
133 2486 sjacqu01
            \param Comp An element comparison predicate
134 2486 sjacqu01
            \return The result of the test
135 2486 sjacqu01

136 2486 sjacqu01
              \note This function provides the strong exception-safety guarantee
137 2486 sjacqu01
        */
138 2486 sjacqu01
        template<typename Range1T, typename Range2T, typename PredicateT>
139 2486 sjacqu01
        inline bool ends_with(
140 2486 sjacqu01
            const Range1T& Input,
141 2486 sjacqu01
            const Range2T& Test,
142 2486 sjacqu01
            PredicateT Comp)
143 2486 sjacqu01
        {
144 2486 sjacqu01
            iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range1T>::type> lit_input(::boost::as_literal(Input));
145 2486 sjacqu01
            iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range2T>::type> lit_test(::boost::as_literal(Test));
146 2486 sjacqu01
147 2486 sjacqu01
            typedef BOOST_STRING_TYPENAME
148 2486 sjacqu01
                range_const_iterator<Range1T>::type Iterator1T;
149 2486 sjacqu01
            typedef BOOST_STRING_TYPENAME boost::detail::
150 2486 sjacqu01
                iterator_traits<Iterator1T>::iterator_category category;
151 2486 sjacqu01
152 2486 sjacqu01
            return detail::
153 2486 sjacqu01
                ends_with_iter_select(
154 2486 sjacqu01
                    ::boost::begin(lit_input),
155 2486 sjacqu01
                    ::boost::end(lit_input),
156 2486 sjacqu01
                    ::boost::begin(lit_test),
157 2486 sjacqu01
                    ::boost::end(lit_test),
158 2486 sjacqu01
                    Comp,
159 2486 sjacqu01
                    category());
160 2486 sjacqu01
        }
161 2486 sjacqu01
162 2486 sjacqu01
163 2486 sjacqu01
        //! 'Ends with' predicate
164 2486 sjacqu01
        /*!
165 2486 sjacqu01
            \overload
166 2486 sjacqu01
        */
167 2486 sjacqu01
        template<typename Range1T, typename Range2T>
168 2486 sjacqu01
        inline bool ends_with(
169 2486 sjacqu01
            const Range1T& Input,
170 2486 sjacqu01
            const Range2T& Test)
171 2486 sjacqu01
        {
172 2486 sjacqu01
            return ::boost::algorithm::ends_with(Input, Test, is_equal());
173 2486 sjacqu01
        }
174 2486 sjacqu01
175 2486 sjacqu01
        //! 'Ends with' predicate ( case insensitive )
176 2486 sjacqu01
        /*!
177 2486 sjacqu01
            This predicate holds when the test container is a suffix of the Input.
178 2486 sjacqu01
            In other words, if the input ends with the test.
179 2486 sjacqu01
            Elements are compared case insensitively.
180 2486 sjacqu01

181 2486 sjacqu01
            \param Input An input sequence
182 2486 sjacqu01
            \param Test A test sequence
183 2486 sjacqu01
            \param Loc A locale used for case insensitive comparison
184 2486 sjacqu01
            \return The result of the test
185 2486 sjacqu01

186 2486 sjacqu01
            \note This function provides the strong exception-safety guarantee
187 2486 sjacqu01
        */
188 2486 sjacqu01
        template<typename Range1T, typename Range2T>
189 2486 sjacqu01
        inline bool iends_with(
190 2486 sjacqu01
            const Range1T& Input,
191 2486 sjacqu01
            const Range2T& Test,
192 2486 sjacqu01
            const std::locale& Loc=std::locale())
193 2486 sjacqu01
        {
194 2486 sjacqu01
            return ::boost::algorithm::ends_with(Input, Test, is_iequal(Loc));
195 2486 sjacqu01
        }
196 2486 sjacqu01
197 2486 sjacqu01
//  contains predicate  -----------------------------------------------//
198 2486 sjacqu01
199 2486 sjacqu01
        //! 'Contains' predicate
200 2486 sjacqu01
        /*!
201 2486 sjacqu01
            This predicate holds when the test container is contained in the Input.
202 2486 sjacqu01
            When the optional predicate is specified, it is used for character-wise
203 2486 sjacqu01
            comparison.
204 2486 sjacqu01

205 2486 sjacqu01
            \param Input An input sequence
206 2486 sjacqu01
            \param Test A test sequence
207 2486 sjacqu01
            \param Comp An element comparison predicate
208 2486 sjacqu01
            \return The result of the test
209 2486 sjacqu01

210 2486 sjacqu01
               \note This function provides the strong exception-safety guarantee
211 2486 sjacqu01
        */
212 2486 sjacqu01
        template<typename Range1T, typename Range2T, typename PredicateT>
213 2486 sjacqu01
        inline bool contains(
214 2486 sjacqu01
            const Range1T& Input,
215 2486 sjacqu01
            const Range2T& Test,
216 2486 sjacqu01
            PredicateT Comp)
217 2486 sjacqu01
        {
218 2486 sjacqu01
            iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range1T>::type> lit_input(::boost::as_literal(Input));
219 2486 sjacqu01
            iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range2T>::type> lit_test(::boost::as_literal(Test));
220 2486 sjacqu01
221 2486 sjacqu01
            if (::boost::empty(lit_test))
222 2486 sjacqu01
            {
223 2486 sjacqu01
                // Empty range is contained always
224 2486 sjacqu01
                return true;
225 2486 sjacqu01
            }
226 2486 sjacqu01
227 2486 sjacqu01
            // Use the temporary variable to make VACPP happy
228 2486 sjacqu01
            bool bResult=(::boost::algorithm::first_finder(lit_test,Comp)(::boost::begin(lit_input), ::boost::end(lit_input)));
229 2486 sjacqu01
            return bResult;
230 2486 sjacqu01
        }
231 2486 sjacqu01
232 2486 sjacqu01
        //! 'Contains' predicate
233 2486 sjacqu01
        /*!
234 2486 sjacqu01
            \overload
235 2486 sjacqu01
        */
236 2486 sjacqu01
        template<typename Range1T, typename Range2T>
237 2486 sjacqu01
        inline bool contains(
238 2486 sjacqu01
            const Range1T& Input,
239 2486 sjacqu01
            const Range2T& Test)
240 2486 sjacqu01
        {
241 2486 sjacqu01
            return ::boost::algorithm::contains(Input, Test, is_equal());
242 2486 sjacqu01
        }
243 2486 sjacqu01
244 2486 sjacqu01
        //! 'Contains' predicate ( case insensitive )
245 2486 sjacqu01
        /*!
246 2486 sjacqu01
            This predicate holds when the test container is contained in the Input.
247 2486 sjacqu01
            Elements are compared case insensitively.
248 2486 sjacqu01

249 2486 sjacqu01
            \param Input An input sequence
250 2486 sjacqu01
            \param Test A test sequence
251 2486 sjacqu01
            \param Loc A locale used for case insensitive comparison
252 2486 sjacqu01
            \return The result of the test
253 2486 sjacqu01

254 2486 sjacqu01
            \note This function provides the strong exception-safety guarantee
255 2486 sjacqu01
        */
256 2486 sjacqu01
        template<typename Range1T, typename Range2T>
257 2486 sjacqu01
        inline bool icontains(
258 2486 sjacqu01
            const Range1T& Input,
259 2486 sjacqu01
            const Range2T& Test,
260 2486 sjacqu01
            const std::locale& Loc=std::locale())
261 2486 sjacqu01
        {
262 2486 sjacqu01
            return ::boost::algorithm::contains(Input, Test, is_iequal(Loc));
263 2486 sjacqu01
        }
264 2486 sjacqu01
265 2486 sjacqu01
//  equals predicate  -----------------------------------------------//
266 2486 sjacqu01
267 2486 sjacqu01
        //! 'Equals' predicate
268 2486 sjacqu01
        /*!
269 2486 sjacqu01
            This predicate holds when the test container is equal to the
270 2486 sjacqu01
            input container i.e. all elements in both containers are same.
271 2486 sjacqu01
            When the optional predicate is specified, it is used for character-wise
272 2486 sjacqu01
            comparison.
273 2486 sjacqu01

274 2486 sjacqu01
            \param Input An input sequence
275 2486 sjacqu01
            \param Test A test sequence
276 2486 sjacqu01
            \param Comp An element comparison predicate
277 2486 sjacqu01
            \return The result of the test
278 2486 sjacqu01

279 2486 sjacqu01
            \note This is a two-way version of \c std::equal algorithm
280 2486 sjacqu01

281 2486 sjacqu01
            \note This function provides the strong exception-safety guarantee
282 2486 sjacqu01
        */
283 2486 sjacqu01
        template<typename Range1T, typename Range2T, typename PredicateT>
284 2486 sjacqu01
        inline bool equals(
285 2486 sjacqu01
            const Range1T& Input,
286 2486 sjacqu01
            const Range2T& Test,
287 2486 sjacqu01
            PredicateT Comp)
288 2486 sjacqu01
        {
289 2486 sjacqu01
            iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range1T>::type> lit_input(::boost::as_literal(Input));
290 2486 sjacqu01
            iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range2T>::type> lit_test(::boost::as_literal(Test));
291 2486 sjacqu01
292 2486 sjacqu01
            typedef BOOST_STRING_TYPENAME
293 2486 sjacqu01
                range_const_iterator<Range1T>::type Iterator1T;
294 2486 sjacqu01
            typedef BOOST_STRING_TYPENAME
295 2486 sjacqu01
                range_const_iterator<Range2T>::type Iterator2T;
296 2486 sjacqu01
297 2486 sjacqu01
            Iterator1T InputEnd=::boost::end(lit_input);
298 2486 sjacqu01
            Iterator2T TestEnd=::boost::end(lit_test);
299 2486 sjacqu01
300 2486 sjacqu01
            Iterator1T it=::boost::begin(lit_input);
301 2486 sjacqu01
            Iterator2T pit=::boost::begin(lit_test);
302 2486 sjacqu01
            for(;
303 2486 sjacqu01
                it!=InputEnd && pit!=TestEnd;
304 2486 sjacqu01
                ++it,++pit)
305 2486 sjacqu01
            {
306 2486 sjacqu01
                if( !(Comp(*it,*pit)) )
307 2486 sjacqu01
                    return false;
308 2486 sjacqu01
            }
309 2486 sjacqu01
310 2486 sjacqu01
            return  (pit==TestEnd) && (it==InputEnd);
311 2486 sjacqu01
        }
312 2486 sjacqu01
313 2486 sjacqu01
        //! 'Equals' predicate
314 2486 sjacqu01
        /*!
315 2486 sjacqu01
            \overload
316 2486 sjacqu01
        */
317 2486 sjacqu01
        template<typename Range1T, typename Range2T>
318 2486 sjacqu01
        inline bool equals(
319 2486 sjacqu01
            const Range1T& Input,
320 2486 sjacqu01
            const Range2T& Test)
321 2486 sjacqu01
        {
322 2486 sjacqu01
            return ::boost::algorithm::equals(Input, Test, is_equal());
323 2486 sjacqu01
        }
324 2486 sjacqu01
325 2486 sjacqu01
        //! 'Equals' predicate ( case insensitive )
326 2486 sjacqu01
        /*!
327 2486 sjacqu01
            This predicate holds when the test container is equal to the
328 2486 sjacqu01
            input container i.e. all elements in both containers are same.
329 2486 sjacqu01
            Elements are compared case insensitively.
330 2486 sjacqu01

331 2486 sjacqu01
            \param Input An input sequence
332 2486 sjacqu01
            \param Test A test sequence
333 2486 sjacqu01
            \param Loc A locale used for case insensitive comparison
334 2486 sjacqu01
            \return The result of the test
335 2486 sjacqu01

336 2486 sjacqu01
            \note This is a two-way version of \c std::equal algorithm
337 2486 sjacqu01

338 2486 sjacqu01
            \note This function provides the strong exception-safety guarantee
339 2486 sjacqu01
        */
340 2486 sjacqu01
        template<typename Range1T, typename Range2T>
341 2486 sjacqu01
        inline bool iequals(
342 2486 sjacqu01
            const Range1T& Input,
343 2486 sjacqu01
            const Range2T& Test,
344 2486 sjacqu01
            const std::locale& Loc=std::locale())
345 2486 sjacqu01
        {
346 2486 sjacqu01
            return ::boost::algorithm::equals(Input, Test, is_iequal(Loc));
347 2486 sjacqu01
        }
348 2486 sjacqu01
349 2486 sjacqu01
// lexicographical_compare predicate -----------------------------//
350 2486 sjacqu01
351 2486 sjacqu01
        //! Lexicographical compare predicate
352 2486 sjacqu01
        /*!
353 2486 sjacqu01
             This predicate is an overload of std::lexicographical_compare
354 2486 sjacqu01
             for range arguments
355 2486 sjacqu01

356 2486 sjacqu01
             It check whether the first argument is lexicographically less
357 2486 sjacqu01
             then the second one.
358 2486 sjacqu01

359 2486 sjacqu01
             If the optional predicate is specified, it is used for character-wise
360 2486 sjacqu01
             comparison
361 2486 sjacqu01

362 2486 sjacqu01
             \param Arg1 First argument
363 2486 sjacqu01
             \param Arg2 Second argument
364 2486 sjacqu01
             \param Pred Comparison predicate
365 2486 sjacqu01
             \return The result of the test
366 2486 sjacqu01

367 2486 sjacqu01
             \note This function provides the strong exception-safety guarantee
368 2486 sjacqu01
         */
369 2486 sjacqu01
        template<typename Range1T, typename Range2T, typename PredicateT>
370 2486 sjacqu01
        inline bool lexicographical_compare(
371 2486 sjacqu01
            const Range1T& Arg1,
372 2486 sjacqu01
            const Range2T& Arg2,
373 2486 sjacqu01
            PredicateT Pred)
374 2486 sjacqu01
        {
375 2486 sjacqu01
            iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range1T>::type> lit_arg1(::boost::as_literal(Arg1));
376 2486 sjacqu01
            iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range2T>::type> lit_arg2(::boost::as_literal(Arg2));
377 2486 sjacqu01
378 2486 sjacqu01
            return std::lexicographical_compare(
379 2486 sjacqu01
                ::boost::begin(lit_arg1),
380 2486 sjacqu01
                ::boost::end(lit_arg1),
381 2486 sjacqu01
                ::boost::begin(lit_arg2),
382 2486 sjacqu01
                ::boost::end(lit_arg2),
383 2486 sjacqu01
                Pred);
384 2486 sjacqu01
        }
385 2486 sjacqu01
386 2486 sjacqu01
        //! Lexicographical compare predicate
387 2486 sjacqu01
        /*!
388 2486 sjacqu01
            \overload
389 2486 sjacqu01
         */
390 2486 sjacqu01
        template<typename Range1T, typename Range2T>
391 2486 sjacqu01
            inline bool lexicographical_compare(
392 2486 sjacqu01
            const Range1T& Arg1,
393 2486 sjacqu01
            const Range2T& Arg2)
394 2486 sjacqu01
        {
395 2486 sjacqu01
            return ::boost::algorithm::lexicographical_compare(Arg1, Arg2, is_less());
396 2486 sjacqu01
        }
397 2486 sjacqu01
398 2486 sjacqu01
        //! Lexicographical compare predicate (case-insensitive)
399 2486 sjacqu01
        /*!
400 2486 sjacqu01
            This predicate is an overload of std::lexicographical_compare
401 2486 sjacqu01
            for range arguments.
402 2486 sjacqu01
            It check whether the first argument is lexicographically less
403 2486 sjacqu01
            then the second one.
404 2486 sjacqu01
            Elements are compared case insensitively
405 2486 sjacqu01

406 2486 sjacqu01

407 2486 sjacqu01
             \param Arg1 First argument
408 2486 sjacqu01
             \param Arg2 Second argument
409 2486 sjacqu01
             \param Loc A locale used for case insensitive comparison
410 2486 sjacqu01
             \return The result of the test
411 2486 sjacqu01

412 2486 sjacqu01
             \note This function provides the strong exception-safety guarantee
413 2486 sjacqu01
         */
414 2486 sjacqu01
        template<typename Range1T, typename Range2T>
415 2486 sjacqu01
        inline bool ilexicographical_compare(
416 2486 sjacqu01
            const Range1T& Arg1,
417 2486 sjacqu01
            const Range2T& Arg2,
418 2486 sjacqu01
            const std::locale& Loc=std::locale())
419 2486 sjacqu01
        {
420 2486 sjacqu01
            return ::boost::algorithm::lexicographical_compare(Arg1, Arg2, is_iless(Loc));
421 2486 sjacqu01
        }
422 2486 sjacqu01
423 2486 sjacqu01
424 2486 sjacqu01
//  all predicate  -----------------------------------------------//
425 2486 sjacqu01
426 2486 sjacqu01
        //! 'All' predicate
427 2486 sjacqu01
        /*!
428 2486 sjacqu01
            This predicate holds it all its elements satisfy a given
429 2486 sjacqu01
            condition, represented by the predicate.
430 2486 sjacqu01

431 2486 sjacqu01
            \param Input An input sequence
432 2486 sjacqu01
            \param Pred A predicate
433 2486 sjacqu01
            \return The result of the test
434 2486 sjacqu01

435 2486 sjacqu01
            \note This function provides the strong exception-safety guarantee
436 2486 sjacqu01
        */
437 2486 sjacqu01
        template<typename RangeT, typename PredicateT>
438 2486 sjacqu01
        inline bool all(
439 2486 sjacqu01
            const RangeT& Input,
440 2486 sjacqu01
            PredicateT Pred)
441 2486 sjacqu01
        {
442 2486 sjacqu01
            iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_input(::boost::as_literal(Input));
443 2486 sjacqu01
444 2486 sjacqu01
            typedef BOOST_STRING_TYPENAME
445 2486 sjacqu01
                range_const_iterator<RangeT>::type Iterator1T;
446 2486 sjacqu01
447 2486 sjacqu01
            Iterator1T InputEnd=::boost::end(lit_input);
448 2486 sjacqu01
            for( Iterator1T It=::boost::begin(lit_input); It!=InputEnd; ++It)
449 2486 sjacqu01
            {
450 2486 sjacqu01
                if (!Pred(*It))
451 2486 sjacqu01
                    return false;
452 2486 sjacqu01
            }
453 2486 sjacqu01
454 2486 sjacqu01
            return true;
455 2486 sjacqu01
        }
456 2486 sjacqu01
457 2486 sjacqu01
    } // namespace algorithm
458 2486 sjacqu01
459 2486 sjacqu01
    // pull names to the boost namespace
460 2486 sjacqu01
    using algorithm::starts_with;
461 2486 sjacqu01
    using algorithm::istarts_with;
462 2486 sjacqu01
    using algorithm::ends_with;
463 2486 sjacqu01
    using algorithm::iends_with;
464 2486 sjacqu01
    using algorithm::contains;
465 2486 sjacqu01
    using algorithm::icontains;
466 2486 sjacqu01
    using algorithm::equals;
467 2486 sjacqu01
    using algorithm::iequals;
468 2486 sjacqu01
    using algorithm::all;
469 2486 sjacqu01
    using algorithm::lexicographical_compare;
470 2486 sjacqu01
    using algorithm::ilexicographical_compare;
471 2486 sjacqu01
472 2486 sjacqu01
} // namespace boost
473 2486 sjacqu01
474 2486 sjacqu01
475 2486 sjacqu01
#endif  // BOOST_STRING_PREDICATE_HPP