|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r69058 - in trunk/boost/geometry: algorithms core extensions/gis/io/wkt geometries/adapted/boost_polygon geometries/concepts
From: barend.gehrels_at_[hidden]
Date: 2011-02-19 09:39:51
Author: barendgehrels
Date: 2011-02-19 09:39:49 EST (Sat, 19 Feb 2011)
New Revision: 69058
URL: http://svn.boost.org/trac/boost/changeset/69058
Log:
Selected other solution for mutable container, now having metafunction rvalue_type
Text files modified:
trunk/boost/geometry/algorithms/append.hpp | 2 +-
trunk/boost/geometry/algorithms/clear.hpp | 18 +++++++++++++++---
trunk/boost/geometry/core/container_access.hpp | 13 ++++++++++---
trunk/boost/geometry/extensions/gis/io/wkt/read_wkt.hpp | 5 ++++-
trunk/boost/geometry/geometries/adapted/boost_polygon/holes_proxy.hpp | 7 +++++++
trunk/boost/geometry/geometries/adapted/boost_polygon/ring.hpp | 4 ++--
trunk/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp | 6 ++++++
trunk/boost/geometry/geometries/concepts/linestring_concept.hpp | 7 ++-----
trunk/boost/geometry/geometries/concepts/polygon_concept.hpp | 16 ++++++++++------
trunk/boost/geometry/geometries/concepts/ring_concept.hpp | 6 ++----
10 files changed, 59 insertions(+), 25 deletions(-)
Modified: trunk/boost/geometry/algorithms/append.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/append.hpp (original)
+++ trunk/boost/geometry/algorithms/append.hpp 2011-02-19 09:39:49 EST (Sat, 19 Feb 2011)
@@ -38,7 +38,7 @@
{
typename geometry::point_type<Geometry>::type copy;
copy_coordinates(point, copy);
- traits::push_back<Geometry&>::apply(geometry, copy);
+ traits::push_back<Geometry>::apply(geometry, copy);
}
};
Modified: trunk/boost/geometry/algorithms/clear.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/clear.hpp (original)
+++ trunk/boost/geometry/algorithms/clear.hpp 2011-02-19 09:39:49 EST (Sat, 19 Feb 2011)
@@ -33,7 +33,7 @@
{
static inline void apply(Geometry& geometry)
{
- traits::clear<Geometry&>::apply(geometry);
+ traits::clear<Geometry>::apply(geometry);
}
};
@@ -42,8 +42,20 @@
{
static inline void apply(Polygon& polygon)
{
- traits::clear<typename traits::interior_mutable_type<Polygon>::type>::apply(interior_rings(polygon));
- traits::clear<typename traits::ring_mutable_type<Polygon>::type>::apply(exterior_ring(polygon));
+ traits::clear
+ <
+ typename boost::remove_reference
+ <
+ typename traits::interior_mutable_type<Polygon>::type
+ >::type
+ >::apply(interior_rings(polygon));
+ traits::clear
+ <
+ typename boost::remove_reference
+ <
+ typename traits::ring_mutable_type<Polygon>::type
+ >::type
+ >::apply(exterior_ring(polygon));
}
};
Modified: trunk/boost/geometry/core/container_access.hpp
==============================================================================
--- trunk/boost/geometry/core/container_access.hpp (original)
+++ trunk/boost/geometry/core/container_access.hpp 2011-02-19 09:39:49 EST (Sat, 19 Feb 2011)
@@ -25,6 +25,12 @@
namespace traits
{
+template <typename Range>
+struct rvalue_type
+{
+ typedef typename boost::remove_reference<Range>::type& type;
+};
+
/*!
\brief Traits class to clear a geometry
\ingroup traits
@@ -32,7 +38,7 @@
template <typename Range>
struct clear
{
- static inline void apply(Range range)
+ static inline void apply(typename rvalue_type<Range>::type range)
{
// The default action: act as it it is a std:: container
range.clear();
@@ -47,7 +53,7 @@
template <typename Range>
struct push_back
{
- static inline void apply(Range range,
+ static inline void apply(typename rvalue_type<Range>::type range,
typename boost::range_value
<
typename boost::remove_reference<Range>::type
@@ -67,7 +73,8 @@
template <typename Range>
struct resize
{
- static inline void apply(Range range, std::size_t new_size)
+ static inline void apply(typename rvalue_type<Range>::type range,
+ std::size_t new_size)
{
// The default action: act as it it is a std:: container
range.resize(new_size);
Modified: trunk/boost/geometry/extensions/gis/io/wkt/read_wkt.hpp
==============================================================================
--- trunk/boost/geometry/extensions/gis/io/wkt/read_wkt.hpp (original)
+++ trunk/boost/geometry/extensions/gis/io/wkt/read_wkt.hpp 2011-02-19 09:39:49 EST (Sat, 19 Feb 2011)
@@ -337,7 +337,10 @@
appender::apply(it, end, wkt, ring);
traits::push_back
<
- typename traits::interior_mutable_type<Polygon>::type
+ typename boost::remove_reference
+ <
+ typename traits::interior_mutable_type<Polygon>::type
+ >::type
>::apply(interior_rings(poly), ring);
}
Modified: trunk/boost/geometry/geometries/adapted/boost_polygon/holes_proxy.hpp
==============================================================================
--- trunk/boost/geometry/geometries/adapted/boost_polygon/holes_proxy.hpp (original)
+++ trunk/boost/geometry/geometries/adapted/boost_polygon/holes_proxy.hpp 2011-02-19 09:39:49 EST (Sat, 19 Feb 2011)
@@ -140,6 +140,13 @@
{
template <typename Polygon>
+struct rvalue_type<adapt::bp::holes_proxy<Polygon> >
+{
+ typedef adapt::bp::holes_proxy<Polygon> type;
+};
+
+
+template <typename Polygon>
struct clear<adapt::bp::holes_proxy<Polygon> >
{
static inline void apply(adapt::bp::holes_proxy<Polygon> proxy)
Modified: trunk/boost/geometry/geometries/adapted/boost_polygon/ring.hpp
==============================================================================
--- trunk/boost/geometry/geometries/adapted/boost_polygon/ring.hpp (original)
+++ trunk/boost/geometry/geometries/adapted/boost_polygon/ring.hpp 2011-02-19 09:39:49 EST (Sat, 19 Feb 2011)
@@ -36,7 +36,7 @@
};
template <typename CoordinateType>
-struct clear<boost::polygon::polygon_data<CoordinateType>& >
+struct clear<boost::polygon::polygon_data<CoordinateType> >
{
static inline void apply(boost::polygon::polygon_data<CoordinateType>& data)
{
@@ -47,7 +47,7 @@
};
template <typename CoordinateType>
-struct push_back<boost::polygon::polygon_data<CoordinateType>& >
+struct push_back<boost::polygon::polygon_data<CoordinateType> >
{
typedef boost::polygon::point_data<CoordinateType> point_type;
Modified: trunk/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp
==============================================================================
--- trunk/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp (original)
+++ trunk/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp 2011-02-19 09:39:49 EST (Sat, 19 Feb 2011)
@@ -240,6 +240,12 @@
template <typename Polygon>
+struct rvalue_type<adapt::bp::ring_proxy<Polygon> >
+{
+ typedef adapt::bp::ring_proxy<Polygon> type;
+};
+
+template <typename Polygon>
struct clear<adapt::bp::ring_proxy<Polygon> >
{
static inline void apply(adapt::bp::ring_proxy<Polygon> proxy)
Modified: trunk/boost/geometry/geometries/concepts/linestring_concept.hpp
==============================================================================
--- trunk/boost/geometry/geometries/concepts/linestring_concept.hpp (original)
+++ trunk/boost/geometry/geometries/concepts/linestring_concept.hpp 2011-02-19 09:39:49 EST (Sat, 19 Feb 2011)
@@ -74,16 +74,13 @@
BOOST_CONCEPT_ASSERT( (concept::Point<point_type>) );
BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
- // There should be a std::back_insert_iterator, to add points
- typedef std::back_insert_iterator<Geometry> back_inserter;
-
public :
BOOST_CONCEPT_USAGE(Linestring)
{
- // Check if it can be modified
Geometry* ls;
- traits::clear<Geometry&>::apply(*ls);
+ traits::clear<Geometry>::apply(*ls);
+ traits::resize<Geometry>::apply(*ls, 0);
}
#endif
};
Modified: trunk/boost/geometry/geometries/concepts/polygon_concept.hpp
==============================================================================
--- trunk/boost/geometry/geometries/concepts/polygon_concept.hpp (original)
+++ trunk/boost/geometry/geometries/concepts/polygon_concept.hpp 2011-02-19 09:39:49 EST (Sat, 19 Feb 2011)
@@ -52,8 +52,10 @@
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename point_type<Geometry>::type point_type;
typedef typename ring_type<Geometry>::type ring_type;
- typedef typename ring_return_type<Geometry>::type ring_return_type;
- typedef typename interior_return_type<Geometry>::type interior_type;
+ typedef typename traits::ring_const_type<Geometry>::type ring_const_type;
+ typedef typename traits::ring_mutable_type<Geometry>::type ring_mutable_type;
+ typedef typename traits::interior_const_type<Geometry>::type interior_const_type;
+ typedef typename traits::interior_mutable_type<Geometry>::type interior_mutable_type;
BOOST_CONCEPT_ASSERT( (concept::Point<point_type>) );
BOOST_CONCEPT_ASSERT( (concept::Ring<ring_type>) );
@@ -65,8 +67,8 @@
static inline void apply()
{
Geometry* poly;
- ring_return_type e = exterior_ring(*poly);
- interior_type i = interior_rings(*poly);
+ ring_mutable_type e = exterior_ring(*poly);
+ interior_mutable_type i = interior_rings(*poly);
boost::ignore_unused_variable_warning(e);
boost::ignore_unused_variable_warning(i);
@@ -106,8 +108,10 @@
typedef typename point_type<Geometry>::type point_type;
typedef typename ring_type<Geometry>::type ring_type;
- typedef typename ring_return_type<Geometry const>::type ring_return_type;
- typedef typename interior_return_type<Geometry const>::type interior_type;
+ typedef typename ring_return_type<Geometry>::type ring_return_type;
+ typedef typename interior_return_type<Geometry>::type interior_type;
+ //typedef typename traits::ring_const_type<Geometry const>::type ring_const_type;
+ //typedef typename traits::interior_const_type<Geometry const>::type interior_const_type;
BOOST_CONCEPT_ASSERT( (concept::ConstPoint<point_type>) );
BOOST_CONCEPT_ASSERT( (concept::ConstRing<ring_type>) );
Modified: trunk/boost/geometry/geometries/concepts/ring_concept.hpp
==============================================================================
--- trunk/boost/geometry/geometries/concepts/ring_concept.hpp (original)
+++ trunk/boost/geometry/geometries/concepts/ring_concept.hpp 2011-02-19 09:39:49 EST (Sat, 19 Feb 2011)
@@ -50,15 +50,13 @@
BOOST_CONCEPT_ASSERT( (concept::Point<point_type>) );
BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
- // There should be a std::back_insert_iterator, to add points
- typedef std::back_insert_iterator<Geometry> back_inserter;
-
public :
BOOST_CONCEPT_USAGE(Ring)
{
Geometry* ring;
- traits::clear<Geometry&>::apply(*ring);
+ traits::clear<Geometry>::apply(*ring);
+ traits::resize<Geometry>::apply(*ring, 0);
}
#endif
};
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk