]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/core/tag_cast.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / geometry / core / tag_cast.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 // This file was modified by Oracle on 2020.
8 // Modifications copyright (c) 2020, Oracle and/or its affiliates.
9 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
10
11 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
12 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
13
14 // Use, modification and distribution is subject to the Boost Software License,
15 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
17
18 #ifndef BOOST_GEOMETRY_CORE_TAG_CAST_HPP
19 #define BOOST_GEOMETRY_CORE_TAG_CAST_HPP
20
21
22 #include <type_traits>
23
24
25 namespace boost { namespace geometry
26 {
27
28 /*!
29 \brief Metafunction defining a type being either the specified tag, or one
30 of the specified basetags if the type inherits from them.
31 \details Tags can inherit each other. A multi_point inherits, for example,
32 both the multi_tag and the pointlike_tag. Often behaviour can be shared
33 between different geometry types. A tag, found by the metafunction tag,
34 can be casted to a more basic tag, and then dispatched by that tag.
35 \ingroup core
36 \tparam Tag The tag to be casted to one of the base tags
37 \tparam BaseTags Base tags
38
39 \qbk{[include reference/core/tag_cast.qbk]}
40 */
41 template <typename Tag, typename ...BaseTags>
42 struct tag_cast
43 {
44 typedef Tag type;
45 };
46
47 #ifndef DOXYGEN_NO_SPECIALIZATIONS
48
49 template <typename Tag, typename BaseTag, typename ...BaseTags>
50 struct tag_cast<Tag, BaseTag, BaseTags...>
51 {
52 typedef std::conditional_t
53 <
54 std::is_base_of<BaseTag, Tag>::value,
55 BaseTag,
56 typename tag_cast
57 <
58 Tag, BaseTags...
59 >::type
60 > type;
61 };
62
63 #endif // DOXYGEN_NO_SPECIALIZATIONS
64
65
66 }} // namespace boost::geometry
67
68 #endif // BOOST_GEOMETRY_CORE_TAG_CAST_HPP