]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/util/parameter_type_of.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / geometry / util / parameter_type_of.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6
7 // Copyright (c) 2020 Oracle and/or its affiliates.
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9
10 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
11 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
12
13 // Use, modification and distribution is subject to the Boost Software License,
14 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
16
17 #ifndef BOOST_GEOMETRY_UTIL_PARAMETER_TYPE_OF_HPP
18 #define BOOST_GEOMETRY_UTIL_PARAMETER_TYPE_OF_HPP
19
20
21 #include <type_traits>
22
23 #include <boost/function_types/function_arity.hpp>
24 #include <boost/function_types/is_member_function_pointer.hpp>
25 #include <boost/function_types/parameter_types.hpp>
26
27 #include <boost/mpl/at.hpp>
28
29
30 namespace boost { namespace geometry
31 {
32
33
34 /*!
35 \brief Meta-function selecting a parameter type of a (member) function, by index
36 \ingroup utility
37 */
38 template <typename Method, std::size_t Index>
39 struct parameter_type_of
40 {
41 typedef typename boost::function_types::parameter_types
42 <
43 Method
44 >::type parameter_types;
45
46 typedef std::conditional_t
47 <
48 boost::function_types::is_member_function_pointer<Method>::value,
49 std::integral_constant<int, 1>,
50 std::integral_constant<int, 0>
51 > base_index_type;
52
53 typedef std::conditional_t
54 <
55 Index == 0,
56 base_index_type,
57 std::integral_constant
58 <
59 int,
60 (base_index_type::value + Index)
61 >
62 > indexed_type;
63
64 typedef typename std::remove_reference
65 <
66 typename boost::mpl::at
67 <
68 parameter_types,
69 indexed_type
70 >::type
71 >::type type;
72 };
73
74
75 }} // namespace boost::geometry
76
77
78 #endif // BOOST_GEOMETRY_UTIL_PARAMETER_TYPE_OF_HPP