[util] replace is_base_of by is_multi where applicable

This commit is contained in:
Barend Gehrels 2024-02-25 16:22:48 +00:00
parent 123c920b92
commit a31a4e15d6
5 changed files with 22 additions and 23 deletions

View File

@ -30,6 +30,7 @@
#include <boost/geometry/util/condition.hpp> #include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/range.hpp> #include <boost/geometry/util/range.hpp>
#include <boost/geometry/util/type_traits.hpp>
#include <type_traits> #include <type_traits>
@ -42,10 +43,12 @@ namespace detail { namespace relate {
// NOTE: This iterates through single geometries for which turns were not generated. // NOTE: This iterates through single geometries for which turns were not generated.
// It doesn't mean that the geometry is disjoint, only that no turns were detected. // It doesn't mean that the geometry is disjoint, only that no turns were detected.
template <std::size_t OpId, template
<
std::size_t OpId,
typename Geometry, typename Geometry,
typename Tag = typename geometry::tag<Geometry>::type, typename Tag = typename geometry::tag<Geometry>::type,
bool IsMulti = std::is_base_of<multi_tag, Tag>::value bool IsMulti = util::is_multi<Geometry>::value
> >
struct for_each_disjoint_geometry_if struct for_each_disjoint_geometry_if
: public not_implemented<Tag> : public not_implemented<Tag>

View File

@ -18,6 +18,7 @@
#include <boost/geometry/core/assert.hpp> #include <boost/geometry/core/assert.hpp>
#include <boost/geometry/core/tag.hpp> #include <boost/geometry/core/tag.hpp>
#include <boost/geometry/util/range.hpp> #include <boost/geometry/util/range.hpp>
#include <boost/geometry/util/type_traits.hpp>
namespace boost { namespace geometry { namespace boost { namespace geometry {
@ -29,11 +30,7 @@ namespace detail_dispatch {
template template
< <
typename Geometry, typename Geometry,
bool IsMulti = std::is_base_of bool IsMulti = util::is_multi<Geometry>::value
<
multi_tag,
typename geometry::tag<Geometry>::type
>::value
> >
struct single_geometry struct single_geometry
{ {

View File

@ -25,6 +25,7 @@
#include <boost/geometry/core/tags.hpp> #include <boost/geometry/core/tags.hpp>
#include <boost/geometry/util/range.hpp> #include <boost/geometry/util/range.hpp>
#include <boost/geometry/util/type_traits.hpp>
namespace boost { namespace geometry { namespace boost { namespace geometry {
@ -33,9 +34,12 @@ namespace boost { namespace geometry {
#ifndef DOXYGEN_NO_DISPATCH #ifndef DOXYGEN_NO_DISPATCH
namespace detail_dispatch { namespace detail_dispatch {
template <typename Geometry, template
<
typename Geometry,
typename Tag = typename geometry::tag<Geometry>::type, typename Tag = typename geometry::tag<Geometry>::type,
bool IsMulti = std::is_base_of<multi_tag, Tag>::value> bool IsMulti = util::is_multi<Geometry>::value
>
struct sub_range : not_implemented<Tag> struct sub_range : not_implemented<Tag>
{}; {};

View File

@ -19,10 +19,9 @@
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_WITHIN_WITHIN_NO_TURNS_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_WITHIN_WITHIN_NO_TURNS_HPP
#include <type_traits>
#include <boost/geometry/algorithms/detail/point_on_border.hpp> #include <boost/geometry/algorithms/detail/point_on_border.hpp>
#include <boost/geometry/algorithms/detail/within/point_in_geometry.hpp> #include <boost/geometry/algorithms/detail/within/point_in_geometry.hpp>
#include <boost/geometry/util/type_traits.hpp>
namespace boost { namespace geometry { namespace boost { namespace geometry {
@ -145,8 +144,8 @@ template <typename Geometry1,
typename Geometry2, typename Geometry2,
typename Tag1 = typename geometry::tag<Geometry1>::type, typename Tag1 = typename geometry::tag<Geometry1>::type,
typename Tag2 = typename geometry::tag<Geometry2>::type, typename Tag2 = typename geometry::tag<Geometry2>::type,
bool IsMulti1 = std::is_base_of<geometry::multi_tag, Tag1>::value, bool IsMulti1 = util::is_multi<Geometry1>::value,
bool IsMulti2 = std::is_base_of<geometry::multi_tag, Tag2>::value> bool IsMulti2 = util::is_multi<Geometry2>::value>
struct within_no_turns_multi struct within_no_turns_multi
{ {
template <typename Strategy> static inline template <typename Strategy> static inline

View File

@ -12,7 +12,8 @@
#include <boost/numeric/conversion/cast.hpp> #include <boost/numeric/conversion/cast.hpp>
#include <boost/rational.hpp> #include <boost/rational.hpp>
namespace boost { namespace geometry namespace boost { namespace geometry { namespace util
{ {
#ifndef DOXYGEN_NO_DETAIL #ifndef DOXYGEN_NO_DETAIL
@ -42,9 +43,6 @@ struct numeric_caster<Target, rational<T>>
} // namespace detail } // namespace detail
#endif #endif
namespace util
{
// Calls either boost::numeric_cast, or functionality specific for Boost.Geometry // Calls either boost::numeric_cast, or functionality specific for Boost.Geometry
// such as rational_cast for Boost.Rational // such as rational_cast for Boost.Rational
template <typename Target, typename Source> template <typename Target, typename Source>
@ -53,8 +51,6 @@ inline Target numeric_cast(Source const& source)
return detail::numeric_caster<Target, Source>::apply(source); return detail::numeric_caster<Target, Source>::apply(source);
} }
} }}} // namespace boost::geometry::util
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_UTIL_NUMERIC_CAST_HPP #endif // BOOST_GEOMETRY_UTIL_NUMERIC_CAST_HPP