1 /* Copyright 2003-2017 Joaquin M Lopez Munoz.
2 * Distributed under the Boost Software License, Version 1.0.
3 * (See accompanying file LICENSE_1_0.txt or copy at
4 * http://www.boost.org/LICENSE_1_0.txt)
6 * See http://www.boost.org/libs/multi_index for library home page.
9 #ifndef BOOST_MULTI_INDEX_DETAIL_PROMOTES_ARG_HPP
10 #define BOOST_MULTI_INDEX_DETAIL_PROMOTES_ARG_HPP
16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
17 #include <boost/detail/workaround.hpp>
19 /* Metafunctions to check if f(arg1,arg2) promotes either arg1 to the type of
20 * arg2 or viceversa. By default, (i.e. if it cannot be determined), no
21 * promotion is assumed.
24 #if BOOST_WORKAROUND(BOOST_MSVC,<1400)
28 namespace multi_index{
32 template<typename F,typename Arg1,typename Arg2>
33 struct promotes_1st_arg:mpl::false_{};
35 template<typename F,typename Arg1,typename Arg2>
36 struct promotes_2nd_arg:mpl::false_{};
38 } /* namespace multi_index::detail */
40 } /* namespace multi_index */
42 } /* namespace boost */
46 #include <boost/mpl/and.hpp>
47 #include <boost/mpl/bool.hpp>
48 #include <boost/mpl/not.hpp>
49 #include <boost/multi_index/detail/is_transparent.hpp>
50 #include <boost/type_traits/is_convertible.hpp>
54 namespace multi_index{
58 template<typename F,typename Arg1,typename Arg2>
59 struct promotes_1st_arg:
61 mpl::not_<is_transparent<F,Arg1,Arg2> >,
62 is_convertible<const Arg1,Arg2>,
63 is_transparent<F,Arg2,Arg2>
67 template<typename F,typename Arg1,typename Arg2>
68 struct promotes_2nd_arg:
70 mpl::not_<is_transparent<F,Arg1,Arg2> >,
71 is_convertible<const Arg2,Arg1>,
72 is_transparent<F,Arg1,Arg1>
76 } /* namespace multi_index::detail */
78 } /* namespace multi_index */
80 } /* namespace boost */