]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/multi_index/include/boost/multi_index/detail/promotes_arg.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / multi_index / include / boost / multi_index / detail / promotes_arg.hpp
1 /* Copyright 2003-2014 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)
5 *
6 * See http://www.boost.org/libs/multi_index for library home page.
7 */
8
9 #ifndef BOOST_MULTI_INDEX_DETAIL_PROMOTES_ARG_HPP
10 #define BOOST_MULTI_INDEX_DETAIL_PROMOTES_ARG_HPP
11
12 #if defined(_MSC_VER)
13 #pragma once
14 #endif
15
16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
17 #include <boost/mpl/bool.hpp>
18 #include <boost/type_traits/intrinsics.hpp>
19
20 /* Metafunctions to check if f(arg1,arg2) promotes either arg1 to the type of
21 * arg2 or viceversa. By default, (i.e. if it cannot be determined), no
22 * promotion is assumed.
23 */
24
25 #if !defined(BOOST_IS_CONVERTIBLE)
26
27 namespace boost{
28
29 namespace multi_index{
30
31 namespace detail{
32
33 template<typename F,typename Arg1,typename Arg2>
34 struct promotes_1st_arg:mpl::false_{};
35
36 template<typename F,typename Arg1,typename Arg2>
37 struct promotes_2nd_arg:mpl::false_{};
38
39 } /* namespace multi_index::detail */
40
41 } /* namespace multi_index */
42
43 } /* namespace boost */
44
45 #else
46
47 #include <boost/mpl/and.hpp>
48 #include <boost/mpl/not.hpp>
49 #include <boost/multi_index/detail/is_transparent.hpp>
50 #include <boost/type_traits/is_convertible.hpp>
51
52 namespace boost{
53
54 namespace multi_index{
55
56 namespace detail{
57
58 template<typename F,typename Arg1,typename Arg2>
59 struct promotes_1st_arg:
60 mpl::and_<
61 mpl::not_<is_transparent<F,Arg1,Arg2> >,
62 is_convertible<const Arg1,Arg2>,
63 is_transparent<F,Arg2,Arg2>
64 >
65 {};
66
67 template<typename F,typename Arg1,typename Arg2>
68 struct promotes_2nd_arg:
69 mpl::and_<
70 mpl::not_<is_transparent<F,Arg1,Arg2> >,
71 is_convertible<const Arg2,Arg1>,
72 is_transparent<F,Arg1,Arg1>
73 >
74 {};
75
76 } /* namespace multi_index::detail */
77
78 } /* namespace multi_index */
79
80 } /* namespace boost */
81
82 #endif /* defined(BOOST_IS_CONVERTIBLE) */
83 #endif