File indexing completed on 2025-01-18 09:42:07
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_MULTI_INDEX_DETAIL_IS_TRANSPARENT_HPP
0010 #define BOOST_MULTI_INDEX_DETAIL_IS_TRANSPARENT_HPP
0011
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015
0016 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
0017 #include <boost/mpl/bool.hpp>
0018 #include <boost/type_traits/intrinsics.hpp>
0019
0020 namespace boost{
0021
0022 namespace multi_index{
0023
0024 namespace detail{
0025
0026
0027
0028
0029
0030
0031 template<typename F,typename Arg1,typename Arg2,typename=void>
0032 struct is_transparent:mpl::true_{};
0033
0034 }
0035
0036 }
0037
0038 }
0039
0040 #if !defined(BOOST_NO_SFINAE)&&!defined(BOOST_NO_SFINAE_EXPR)&& \
0041 !defined(BOOST_NO_CXX11_DECLTYPE)&& \
0042 (defined(BOOST_NO_CXX11_FINAL)||defined(BOOST_IS_FINAL))
0043
0044 #include <boost/core/enable_if.hpp>
0045 #include <boost/mpl/and.hpp>
0046 #include <boost/mpl/not.hpp>
0047 #include <boost/mpl/or.hpp>
0048 #include <boost/type_traits/declval.hpp>
0049 #include <boost/type_traits/function_traits.hpp>
0050 #include <boost/type_traits/is_class.hpp>
0051 #include <boost/type_traits/is_final.hpp>
0052 #include <boost/type_traits/is_function.hpp>
0053 #include <boost/type_traits/is_same.hpp>
0054 #include <boost/type_traits/remove_pointer.hpp>
0055
0056 namespace boost{
0057
0058 namespace multi_index{
0059
0060 namespace detail{
0061
0062 struct not_is_transparent_result_type{};
0063
0064 template<typename F,typename Arg1,typename Arg2>
0065 struct is_transparent_class_helper:F
0066 {
0067 using F::operator();
0068 template<typename T,typename Q>
0069 not_is_transparent_result_type operator()(const T&,const Q&)const;
0070 };
0071
0072 template<typename F,typename Arg1,typename Arg2,typename=void>
0073 struct is_transparent_class:mpl::true_{};
0074
0075 template<typename F,typename Arg1,typename Arg2>
0076 struct is_transparent_class<
0077 F,Arg1,Arg2,
0078 typename enable_if<
0079 is_same<
0080 decltype(
0081 declval<const is_transparent_class_helper<F,Arg1,Arg2> >()(
0082 declval<const Arg1&>(),declval<const Arg2&>())
0083 ),
0084 not_is_transparent_result_type
0085 >
0086 >::type
0087 >:mpl::false_{};
0088
0089 template<typename F,typename Arg1,typename Arg2>
0090 struct is_transparent<
0091 F,Arg1,Arg2,
0092 typename enable_if<
0093 mpl::and_<
0094 is_class<F>,
0095 mpl::not_<is_final<F> >
0096 >
0097 >::type
0098 >:is_transparent_class<F,Arg1,Arg2>{};
0099
0100 template<typename F,typename Arg1,typename Arg2,typename=void>
0101 struct is_transparent_function:mpl::true_{};
0102
0103 template<typename F,typename Arg1,typename Arg2>
0104 struct is_transparent_function<
0105 F,Arg1,Arg2,
0106 typename enable_if<
0107 mpl::or_<
0108 mpl::not_<mpl::or_<
0109 is_same<typename function_traits<F>::arg1_type,const Arg1&>,
0110 is_same<typename function_traits<F>::arg1_type,Arg1>
0111 > >,
0112 mpl::not_<mpl::or_<
0113 is_same<typename function_traits<F>::arg2_type,const Arg2&>,
0114 is_same<typename function_traits<F>::arg2_type,Arg2>
0115 > >
0116 >
0117 >::type
0118 >:mpl::false_{};
0119
0120 template<typename F,typename Arg1,typename Arg2>
0121 struct is_transparent<
0122 F,Arg1,Arg2,
0123 typename enable_if<
0124 is_function<typename remove_pointer<F>::type>
0125 >::type
0126 >:is_transparent_function<typename remove_pointer<F>::type,Arg1,Arg2>{};
0127
0128 }
0129
0130 }
0131
0132 }
0133
0134 #endif
0135 #endif