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_IN_RANGE_HPP_INCLUDED_
0016 #define BOOST_LOG_UTILITY_FUNCTIONAL_IN_RANGE_HPP_INCLUDED_
0017
0018 #include <utility>
0019 #include <boost/type_traits/is_integral.hpp>
0020 #include <boost/type_traits/integral_constant.hpp>
0021 #include <boost/log/detail/config.hpp>
0022 #include <boost/log/utility/functional/logical.hpp> // make_common_integral_type
0023 #include <boost/log/detail/header.hpp>
0024
0025 #ifdef BOOST_HAS_PRAGMA_ONCE
0026 #pragma once
0027 #endif
0028
0029 namespace boost {
0030
0031 BOOST_LOG_OPEN_NAMESPACE
0032
0033
0034 struct in_range_fun
0035 {
0036 typedef bool result_type;
0037
0038 template< typename T, typename U >
0039 bool operator() (T const& value, std::pair< U, U > const& rng) const
0040 {
0041 return op(value, rng, integral_constant< bool, is_integral< T >::value && is_integral< U >::value >());
0042 }
0043
0044 private:
0045 template< typename T, typename U >
0046 static bool op(T const& value, std::pair< U, U > const& rng, false_type)
0047 {
0048 return (value >= rng.first && value < rng.second);
0049 }
0050 template< typename T, typename U >
0051 static bool op(T const& value, std::pair< U, U > const& rng, true_type)
0052 {
0053 typedef typename aux::make_common_integral_type< T, U >::type common_integral_type;
0054 return (static_cast< common_integral_type >(value) >= static_cast< common_integral_type >(rng.first))
0055 && (static_cast< common_integral_type >(value) < static_cast< common_integral_type >(rng.second));
0056 }
0057 };
0058
0059 BOOST_LOG_CLOSE_NAMESPACE
0060
0061 }
0062
0063 #include <boost/log/detail/footer.hpp>
0064
0065 #endif