File indexing completed on 2025-01-18 09:39:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_LOG_UTILITY_FUNCTIONAL_CONTAINS_HPP_INCLUDED_
0016 #define BOOST_LOG_UTILITY_FUNCTIONAL_CONTAINS_HPP_INCLUDED_
0017
0018 #include <boost/log/detail/config.hpp>
0019 #include <boost/log/detail/header.hpp>
0020
0021 #ifdef BOOST_HAS_PRAGMA_ONCE
0022 #pragma once
0023 #endif
0024
0025 namespace boost {
0026
0027 BOOST_LOG_OPEN_NAMESPACE
0028
0029
0030 struct contains_fun
0031 {
0032 typedef bool result_type;
0033
0034 template< typename T, typename U >
0035 bool operator() (T const& left, U const& right) const
0036 {
0037 typedef typename T::const_iterator left_iterator;
0038 typedef typename U::const_iterator right_iterator;
0039
0040 typename U::size_type const right_size = right.size();
0041 if (left.size() >= right_size)
0042 {
0043 const left_iterator search_end = left.end() - right_size + 1;
0044 const right_iterator right_end = right.end();
0045 for (left_iterator it = left.begin(); it != search_end; ++it)
0046 {
0047 left_iterator left_it = it;
0048 right_iterator right_it = right.begin();
0049 for (; right_it != right_end; ++left_it, ++right_it)
0050 {
0051 if (*left_it != *right_it)
0052 break;
0053 }
0054 if (right_it == right_end)
0055 return true;
0056 }
0057 }
0058
0059 return false;
0060 }
0061 };
0062
0063 BOOST_LOG_CLOSE_NAMESPACE
0064
0065 }
0066
0067 #include <boost/log/detail/footer.hpp>
0068
0069 #endif