]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/multi_index/include/boost/multi_index/detail/promotes_arg.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / multi_index / include / boost / multi_index / detail / promotes_arg.hpp
CommitLineData
7c673cae
FG
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
27namespace boost{
28
29namespace multi_index{
30
31namespace detail{
32
33template<typename F,typename Arg1,typename Arg2>
34struct promotes_1st_arg:mpl::false_{};
35
36template<typename F,typename Arg1,typename Arg2>
37struct 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
52namespace boost{
53
54namespace multi_index{
55
56namespace detail{
57
58template<typename F,typename Arg1,typename Arg2>
59struct 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
67template<typename F,typename Arg1,typename Arg2>
68struct 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