Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/log/utility/functional/ends_with.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 /* | |
2 * Copyright Andrey Semashev 2007 - 2013. | |
3 * Distributed under the Boost Software License, Version 1.0. | |
4 * (See accompanying file LICENSE_1_0.txt or copy at | |
5 * http://www.boost.org/LICENSE_1_0.txt) | |
6 */ | |
7 /*! | |
8 * \file ends_with.hpp | |
9 * \author Andrey Semashev | |
10 * \date 30.03.2008 | |
11 * | |
12 * This header contains a predicate for checking if the provided string ends with a substring. | |
13 */ | |
14 | |
15 #ifndef BOOST_LOG_UTILITY_FUNCTIONAL_ENDS_WITH_HPP_INCLUDED_ | |
16 #define BOOST_LOG_UTILITY_FUNCTIONAL_ENDS_WITH_HPP_INCLUDED_ | |
17 | |
18 #include <boost/log/detail/config.hpp> | |
19 #include <boost/log/detail/header.hpp> | |
20 | |
21 #ifdef BOOST_HAS_PRAGMA_ONCE | |
22 #pragma once | |
23 #endif | |
24 | |
25 namespace boost { | |
26 | |
27 BOOST_LOG_OPEN_NAMESPACE | |
28 | |
29 //! The \c ends_with functor | |
30 struct ends_with_fun | |
31 { | |
32 typedef bool result_type; | |
33 | |
34 template< typename T, typename U > | |
35 bool operator() (T const& left, U const& right) const | |
36 { | |
37 typedef typename T::const_reverse_iterator left_iterator; | |
38 typedef typename U::const_reverse_iterator right_iterator; | |
39 | |
40 left_iterator left_it = left.rbegin(), left_end = left.rend(); | |
41 right_iterator right_it = right.rbegin(), right_end = right.rend(); | |
42 for (; left_it != left_end && right_it != right_end; ++left_it, ++right_it) | |
43 { | |
44 if (*left_it != *right_it) | |
45 break; | |
46 } | |
47 return right_it == right_end; | |
48 } | |
49 }; | |
50 | |
51 BOOST_LOG_CLOSE_NAMESPACE // namespace log | |
52 | |
53 } // namespace boost | |
54 | |
55 #include <boost/log/detail/footer.hpp> | |
56 | |
57 #endif // BOOST_LOG_UTILITY_FUNCTIONAL_ENDS_WITH_HPP_INCLUDED_ |