Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 34 additions & 10 deletions include/boost/geometry/algorithms/area_result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <boost/geometry/util/select_most_precise.hpp>
#include <boost/geometry/util/sequence.hpp>
#include <boost/geometry/util/type_traits.hpp>

#include <boost/variant/variant_fwd.hpp>

Expand All @@ -51,17 +52,18 @@ struct area_result
typedef typename strategy_type::template result_type<Geometry>::type type;
};

template <typename Geometry, typename Strategy>
struct area_result<Geometry, Strategy, false>
{
typedef typename Strategy::template result_type<Geometry>::type type;
};


template
<
typename Geometry,
typename Strategy
bool IsGeometry = util::is_geometry<Geometry>::value
>
struct area_result<Geometry, Strategy, false>
: Strategy::template result_type<Geometry>
{};


template <typename Geometry>
struct default_area_result
: area_result
<
Expand All @@ -73,15 +75,37 @@ struct default_area_result
>
{};

// Workaround for VS2015
#if (_MSC_VER < 1910)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be explicitly _MSC_VER == 1900 or there is hope that the workaround will also work with older than VS15 versions ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think that the older VS will compile the library.

This way the checks are symmetric, i.e. < 1910 vs >= 1910.

template
<
typename Geometry,
bool IsGeometry = util::is_geometry<Geometry>::value
>
struct coordinate_type
: geometry::coordinate_type<Geometry>
{};
template <typename Geometry>
struct coordinate_type<Geometry, false>
{
typedef int type;
};
template <typename Geometry>
struct default_area_result<Geometry, false>
{
typedef int type;
};
#endif

template <typename Curr, typename Next>
struct more_precise_coordinate_type
: std::is_same
<
typename geometry::coordinate_type<Curr>::type,
typename coordinate_type<Curr>::type,
typename geometry::select_most_precise
<
typename geometry::coordinate_type<Curr>::type,
typename geometry::coordinate_type<Next>::type
typename coordinate_type<Curr>::type,
typename coordinate_type<Next>::type
>::type
>
{};
Expand Down
12 changes: 10 additions & 2 deletions include/boost/geometry/arithmetic/cross_product.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ template
int
> = 0
>
constexpr inline ResultP cross_product(P1 const& p1, P2 const& p2)
// workaround for VS2015
#if (_MSC_VER >= 1910)
constexpr
#endif
inline ResultP cross_product(P1 const& p1, P2 const& p2)
{
BOOST_CONCEPT_ASSERT((concepts::Point<ResultP>));
BOOST_CONCEPT_ASSERT((concepts::ConstPoint<P1>));
Expand Down Expand Up @@ -210,7 +214,11 @@ template
int
> = 0
>
constexpr inline P cross_product(P const& p1, P const& p2)
// workaround for VS2015
#if (_MSC_VER >= 1910)
constexpr
#endif
inline P cross_product(P const& p1, P const& p2)
{
BOOST_CONCEPT_ASSERT((concepts::Point<P>));
BOOST_CONCEPT_ASSERT((concepts::ConstPoint<P>));
Expand Down
6 changes: 5 additions & 1 deletion include/boost/geometry/arithmetic/dot_product.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ struct dot_product_maker<P1, P2, DimensionCount, DimensionCount>

*/
template <typename Point1, typename Point2>
constexpr inline typename select_coordinate_type<Point1, Point2>::type dot_product(
// workaround for VS2015
#if (_MSC_VER >= 1910)
constexpr
#endif
inline typename select_coordinate_type<Point1, Point2>::type dot_product(
Point1 const& p1, Point2 const& p2)
{
BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<Point1>) );
Expand Down
8 changes: 7 additions & 1 deletion include/boost/geometry/geometries/point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ class point

#if !defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
/// \constructor_default_no_init
constexpr point() = default;
constexpr point()
// Workaround for VS2015
#if (_MSC_VER < 1910)
: m_values{} {}
#else
= default;
#endif
#else // defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
point()
{
Expand Down
29 changes: 25 additions & 4 deletions include/boost/geometry/strategies/comparable_distance_result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@
#include <boost/geometry/strategies/distance.hpp>
#include <boost/geometry/util/select_most_precise.hpp>
#include <boost/geometry/util/sequence.hpp>
#include <boost/geometry/util/type_traits.hpp>


namespace boost { namespace geometry
{

namespace resolve_strategy
{

template <typename Geometry1, typename Geometry2, typename Strategy>

template
<
typename Geometry1, typename Geometry2, typename Strategy,
bool AreGeometries = (util::is_geometry<Geometry1>::value
&& util::is_geometry<Geometry2>::value)
>
struct comparable_distance_result
: strategy::distance::services::return_type
<
Expand All @@ -41,8 +47,8 @@ struct comparable_distance_result
>
{};

template <typename Geometry1, typename Geometry2>
struct comparable_distance_result<Geometry1, Geometry2, default_strategy>
template <typename Geometry1, typename Geometry2, bool AreGeometries>
struct comparable_distance_result<Geometry1, Geometry2, default_strategy, AreGeometries>
: comparable_distance_result
<
Geometry1,
Expand All @@ -54,6 +60,21 @@ struct comparable_distance_result<Geometry1, Geometry2, default_strategy>
>
{};

// Workaround for VS2015
#if (_MSC_VER < 1910)
template <typename Geometry1, typename Geometry2, typename Strategy>
struct comparable_distance_result<Geometry1, Geometry2, Strategy, false>
{
typedef int type;
};
template <typename Geometry1, typename Geometry2>
struct comparable_distance_result<Geometry1, Geometry2, default_strategy, false>
{
typedef int type;
};
#endif


} // namespace resolve_strategy


Expand Down
18 changes: 18 additions & 0 deletions include/boost/geometry/strategies/default_length_result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/util/select_most_precise.hpp>
#include <boost/geometry/util/type_traits.hpp>


namespace boost { namespace geometry
Expand All @@ -40,6 +41,23 @@ namespace resolve_strategy
// default_distance_result here.


// Workaround for VS2015
#if (_MSC_VER < 1910)
template
<
typename Geometry,
bool IsGeometry = util::is_geometry<Geometry>::value
>
struct coordinate_type
: geometry::coordinate_type<Geometry>
{};
template <typename Geometry>
struct coordinate_type<Geometry, false>
{
typedef long double type;
};
#endif

template <typename ...Geometries>
struct default_length_result
{
Expand Down
28 changes: 25 additions & 3 deletions include/boost/geometry/strategies/distance_result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <boost/geometry/strategies/distance.hpp>
#include <boost/geometry/util/select_most_precise.hpp>
#include <boost/geometry/util/sequence.hpp>
#include <boost/geometry/util/type_traits.hpp>

namespace boost { namespace geometry
{
Expand All @@ -38,7 +39,12 @@ namespace boost { namespace geometry
namespace resolve_strategy
{

template <typename Geometry1, typename Geometry2, typename Strategy>
template
<
typename Geometry1, typename Geometry2, typename Strategy,
bool AreGeometries = (util::is_geometry<Geometry1>::value
&& util::is_geometry<Geometry2>::value)
>
struct distance_result
: strategy::distance::services::return_type
<
Expand All @@ -48,8 +54,8 @@ struct distance_result
>
{};

template <typename Geometry1, typename Geometry2>
struct distance_result<Geometry1, Geometry2, default_strategy>
template <typename Geometry1, typename Geometry2, bool AreGeometries>
struct distance_result<Geometry1, Geometry2, default_strategy, AreGeometries>
: distance_result
<
Geometry1,
Expand All @@ -61,6 +67,22 @@ struct distance_result<Geometry1, Geometry2, default_strategy>
>
{};


// Workaround for VS2015
#if (_MSC_VER < 1910)
template <typename Geometry1, typename Geometry2, typename Strategy>
struct distance_result<Geometry1, Geometry2, Strategy, false>
{
typedef int type;
};
template <typename Geometry1, typename Geometry2>
struct distance_result<Geometry1, Geometry2, default_strategy, false>
{
typedef int type;
};
#endif


} // namespace resolve_strategy


Expand Down