File indexing completed on 2025-01-18 09:29:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_BIMAP_CONTAINER_ADAPTOR_DETAIL_COMPARISON_ADAPTOR_HPP
0013 #define BOOST_BIMAP_CONTAINER_ADAPTOR_DETAIL_COMPARISON_ADAPTOR_HPP
0014
0015 #if defined(_MSC_VER)
0016 #pragma once
0017 #endif
0018
0019 #include <boost/config.hpp>
0020
0021 #include <boost/call_traits.hpp>
0022
0023 namespace boost {
0024 namespace bimaps {
0025 namespace container_adaptor {
0026 namespace detail {
0027
0028
0029
0030
0031
0032
0033
0034 template < class Compare, class NewType, class Converter >
0035 struct comparison_adaptor
0036 {
0037 typedef NewType first_argument_type;
0038 typedef NewType second_argument_type;
0039 typedef bool result_type;
0040
0041 comparison_adaptor( const Compare & comp, const Converter & conv)
0042 : compare(comp), converter(conv) {}
0043
0044 bool operator()( BOOST_DEDUCED_TYPENAME call_traits<NewType>::param_type x,
0045 BOOST_DEDUCED_TYPENAME call_traits<NewType>::param_type y) const
0046 {
0047 return compare( converter(x), converter(y) );
0048 }
0049
0050 private:
0051 Compare compare;
0052 Converter converter;
0053 };
0054
0055 template < class Compare, class NewType, class Converter >
0056 struct compatible_comparison_adaptor
0057 {
0058 typedef NewType first_argument_type;
0059 typedef NewType second_argument_type;
0060 typedef bool result_type;
0061
0062 compatible_comparison_adaptor( const Compare & comp, const Converter & conv)
0063 : compare(comp), converter(conv) {}
0064
0065 template< class CompatibleTypeLeft, class CompatibleTypeRight >
0066 bool operator()( const CompatibleTypeLeft & x,
0067 const CompatibleTypeRight & y) const
0068 {
0069 return compare( converter(x), converter(y) );
0070 }
0071
0072 private:
0073 Compare compare;
0074 Converter converter;
0075 };
0076
0077
0078
0079
0080
0081
0082
0083
0084 template < class Compare, class NewType, class Converter >
0085 struct unary_check_adaptor
0086 {
0087 typedef BOOST_DEDUCED_TYPENAME call_traits<NewType>::param_type argument_type;
0088 typedef bool result_type;
0089
0090 unary_check_adaptor( const Compare & comp, const Converter & conv ) :
0091 compare(comp), converter(conv) {}
0092
0093 bool operator()( BOOST_DEDUCED_TYPENAME call_traits<NewType>::param_type x) const
0094 {
0095 return compare( converter(x) );
0096 }
0097
0098 private:
0099 Compare compare;
0100 Converter converter;
0101 };
0102
0103 }
0104 }
0105 }
0106 }
0107
0108
0109 #endif
0110
0111