Skip to content

Commit

Permalink
[util] replace is_base_of by is_multi where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
barendgehrels committed Feb 25, 2024
1 parent 123c920 commit a31a4e1
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/range.hpp>
#include <boost/geometry/util/type_traits.hpp>

#include <type_traits>

Expand All @@ -42,10 +43,12 @@ namespace detail { namespace relate {
// 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.

template <std::size_t OpId,
typename Geometry,
typename Tag = typename geometry::tag<Geometry>::type,
bool IsMulti = std::is_base_of<multi_tag, Tag>::value
template
<
std::size_t OpId,
typename Geometry,
typename Tag = typename geometry::tag<Geometry>::type,
bool IsMulti = util::is_multi<Geometry>::value
>
struct for_each_disjoint_geometry_if
: public not_implemented<Tag>
Expand Down
7 changes: 2 additions & 5 deletions include/boost/geometry/algorithms/detail/single_geometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <boost/geometry/core/assert.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/util/range.hpp>
#include <boost/geometry/util/type_traits.hpp>

namespace boost { namespace geometry {

Expand All @@ -29,11 +30,7 @@ namespace detail_dispatch {
template
<
typename Geometry,
bool IsMulti = std::is_base_of
<
multi_tag,
typename geometry::tag<Geometry>::type
>::value
bool IsMulti = util::is_multi<Geometry>::value
>
struct single_geometry
{
Expand Down
10 changes: 7 additions & 3 deletions include/boost/geometry/algorithms/detail/sub_range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <boost/geometry/core/tags.hpp>

#include <boost/geometry/util/range.hpp>
#include <boost/geometry/util/type_traits.hpp>

namespace boost { namespace geometry {

Expand All @@ -33,9 +34,12 @@ namespace boost { namespace geometry {
#ifndef DOXYGEN_NO_DISPATCH
namespace detail_dispatch {

template <typename Geometry,
typename Tag = typename geometry::tag<Geometry>::type,
bool IsMulti = std::is_base_of<multi_tag, Tag>::value>
template
<
typename Geometry,
typename Tag = typename geometry::tag<Geometry>::type,
bool IsMulti = util::is_multi<Geometry>::value
>
struct sub_range : not_implemented<Tag>
{};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
#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/within/point_in_geometry.hpp>
#include <boost/geometry/util/type_traits.hpp>

namespace boost { namespace geometry {

Expand Down Expand Up @@ -145,8 +144,8 @@ template <typename Geometry1,
typename Geometry2,
typename Tag1 = typename geometry::tag<Geometry1>::type,
typename Tag2 = typename geometry::tag<Geometry2>::type,
bool IsMulti1 = std::is_base_of<geometry::multi_tag, Tag1>::value,
bool IsMulti2 = std::is_base_of<geometry::multi_tag, Tag2>::value>
bool IsMulti1 = util::is_multi<Geometry1>::value,
bool IsMulti2 = util::is_multi<Geometry2>::value>
struct within_no_turns_multi
{
template <typename Strategy> static inline
Expand Down
10 changes: 3 additions & 7 deletions include/boost/geometry/util/numeric_cast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#include <boost/numeric/conversion/cast.hpp>
#include <boost/rational.hpp>

namespace boost { namespace geometry
namespace boost { namespace geometry { namespace util

{

#ifndef DOXYGEN_NO_DETAIL
Expand Down Expand Up @@ -42,9 +43,6 @@ struct numeric_caster<Target, rational<T>>
} // namespace detail
#endif

namespace util
{

// Calls either boost::numeric_cast, or functionality specific for Boost.Geometry
// such as rational_cast for Boost.Rational
template <typename Target, typename Source>
Expand All @@ -53,8 +51,6 @@ inline Target numeric_cast(Source const& source)
return detail::numeric_caster<Target, Source>::apply(source);
}

}

}} // namespace boost::geometry
}}} // namespace boost::geometry::util

#endif // BOOST_GEOMETRY_UTIL_NUMERIC_CAST_HPP

0 comments on commit a31a4e1

Please sign in to comment.