diff --git a/include/boost/geometry/algorithms/length.hpp b/include/boost/geometry/algorithms/length.hpp index 0517a7c25..6cbec5303 100644 --- a/include/boost/geometry/algorithms/length.hpp +++ b/include/boost/geometry/algorithms/length.hpp @@ -1,8 +1,13 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. + +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -181,36 +186,21 @@ namespace resolve_variant { template struct length { - typedef typename default_length_result::type result_type; - template - static inline result_type apply(Geometry const& geometry, - Strategy const& strategy) + static inline typename default_length_result::type + apply(Geometry const& geometry, Strategy const& strategy) { return dispatch::length::apply(geometry, strategy); } }; template -struct length > +struct length > { - typedef typename mpl::fold< - typename mpl::transform< - typename variant::types, - default_length_result - >::type, - mpl::set0<>, - mpl::insert - >::type possible_result_types; - - typedef typename mpl::if_< - mpl::greater< - mpl::size, - mpl::int_<1> - >, - typename make_variant_over::type, - typename mpl::front::type - >::type result_type; + typedef typename default_length_result + < + boost::variant + >::type result_type; template struct visitor @@ -223,7 +213,7 @@ struct length > {} template - inline typename length::result_type + inline typename default_length_result::type operator()(Geometry const& geometry) const { return length::apply(geometry, m_strategy); @@ -255,7 +245,7 @@ struct length > \qbk{[length] [length_output]} */ template -inline typename resolve_variant::length::result_type +inline typename default_length_result::type length(Geometry const& geometry) { concept::check(); @@ -287,7 +277,7 @@ length(Geometry const& geometry) \qbk{[length_with_strategy] [length_with_strategy_output]} */ template -inline typename resolve_variant::length::result_type +inline typename default_length_result::type length(Geometry const& geometry, Strategy const& strategy) { concept::check(); diff --git a/include/boost/geometry/algorithms/perimeter.hpp b/include/boost/geometry/algorithms/perimeter.hpp index 27d80e97b..0ec153c1f 100644 --- a/include/boost/geometry/algorithms/perimeter.hpp +++ b/include/boost/geometry/algorithms/perimeter.hpp @@ -1,8 +1,13 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. + +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -30,8 +35,6 @@ #include #include #include -#include -#include namespace boost { namespace geometry { @@ -134,10 +137,8 @@ namespace resolve_variant { template struct perimeter { - typedef typename default_length_result::type result_type; - template - static inline result_type + static inline typename default_length_result::type apply(Geometry const& geometry, Strategy const& strategy) { concept::check(); @@ -148,12 +149,10 @@ struct perimeter template struct perimeter > { - typedef typename compress_variant< - typename transform_variant< - boost::variant, - default_length_result - >::type - >:: type result_type; + typedef typename default_length_result + < + boost::variant + >::type result_type; template struct visitor: boost::static_visitor @@ -163,7 +162,8 @@ struct perimeter > visitor(Strategy const& strategy): m_strategy(strategy) {} template - result_type operator()(Geometry const& geometry) const + typename default_length_result::type + operator()(Geometry const& geometry) const { return perimeter::apply(geometry, m_strategy); } @@ -193,7 +193,7 @@ struct perimeter > \qbk{[include reference/algorithms/perimeter.qbk]} */ template -inline typename resolve_variant::perimeter::result_type perimeter( +inline typename default_length_result::type perimeter( Geometry const& geometry) { // detail::throw_on_empty_input(geometry); @@ -215,7 +215,7 @@ inline typename resolve_variant::perimeter::result_type perimeter( \qbk{[include reference/algorithms/perimeter.qbk]} */ template -inline typename resolve_variant::perimeter::result_type perimeter( +inline typename default_length_result::type perimeter( Geometry const& geometry, Strategy const& strategy) { // detail::throw_on_empty_input(geometry); diff --git a/include/boost/geometry/strategies/default_length_result.hpp b/include/boost/geometry/strategies/default_length_result.hpp index 706941b9e..806e4284c 100644 --- a/include/boost/geometry/strategies/default_length_result.hpp +++ b/include/boost/geometry/strategies/default_length_result.hpp @@ -1,8 +1,13 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. + +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -14,14 +19,57 @@ #ifndef BOOST_GEOMETRY_STRATEGIES_DEFAULT_LENGTH_RESULT_HPP #define BOOST_GEOMETRY_STRATEGIES_DEFAULT_LENGTH_RESULT_HPP +#include #include + +#include #include +#include namespace boost { namespace geometry { + +namespace resolve_strategy +{ + +template +struct default_length_result +{ + typedef typename select_most_precise + < + typename coordinate_type::type, + long double + >::type type; +}; + +} // namespace resolve_strategy + + +namespace resolve_variant +{ + +template +struct default_length_result + : resolve_strategy::default_length_result +{}; + +template +struct default_length_result > +{ + typedef typename compress_variant< + typename transform_variant< + boost::variant, + resolve_strategy::default_length_result + >::type + >::type type; +}; + +} // namespace resolve_variant + + /*! \brief Meta-function defining return type of length function \ingroup length @@ -32,15 +80,10 @@ namespace boost { namespace geometry */ template struct default_length_result -{ - typedef typename select_most_precise - < - typename coordinate_type::type, - long double - >::type type; -}; + : resolve_variant::default_length_result +{}; + }} // namespace boost::geometry - #endif // BOOST_GEOMETRY_STRATEGIES_DEFAULT_LENGTH_RESULT_HPP