Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61901 - sandbox/geometry/libs/geometry/example
From: barend.gehrels_at_[hidden]
Date: 2010-05-11 00:18:26


Author: barendgehrels
Date: 2010-05-11 00:18:22 EDT (Tue, 11 May 2010)
New Revision: 61901
URL: http://svn.boost.org/trac/boost/changeset/61901

Log:
Fixed scoped_ptr/array thanks to Boostcon feedback
Text files modified:
   sandbox/geometry/libs/geometry/example/x04_wxwidgets_world_mapper.cpp | 34 ++++++++++++++++++++++++++++++----
   1 files changed, 30 insertions(+), 4 deletions(-)

Modified: sandbox/geometry/libs/geometry/example/x04_wxwidgets_world_mapper.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/x04_wxwidgets_world_mapper.cpp (original)
+++ sandbox/geometry/libs/geometry/example/x04_wxwidgets_world_mapper.cpp 2010-05-11 00:18:22 EDT (Tue, 11 May 2010)
@@ -18,7 +18,7 @@
 
 #include <boost/foreach.hpp>
 #include <boost/shared_ptr.hpp>
-#include <boost/scoped_ptr.hpp>
+#include <boost/scoped_array.hpp>
 
 #include <boost/geometry/geometry.hpp>
 #include <boost/geometry/geometries/register/point.hpp>
@@ -52,7 +52,8 @@
 BOOST_GEOMETRY_REGISTER_POINT_2D(wxPoint, int, cs::cartesian, x, y)
 BOOST_GEOMETRY_REGISTER_POINT_2D(wxRealPoint, double, cs::cartesian, x, y)
 
-BOOST_GEOMETRY_REGISTER_RING(wxPointPointerPair);
+// Done explicitly below to implement "clear"
+//BOOST_GEOMETRY_REGISTER_RING(wxPointPointerPair);
 
 
 
@@ -100,6 +101,31 @@
 }
 
 
+namespace boost { namespace geometry { namespace traits
+{
+ template <>
+ struct tag< wxPointPointerPair > { typedef ring_tag type; };
+
+ template <>
+ struct use_std< wxPointPointerPair >
+ {
+ static bool const value = false;
+ };
+
+ template <>
+ struct clear< wxPointPointerPair >
+ {
+ static inline void apply(wxPointPointerPair& ls)
+ {
+ // Empty on purpose, fixed size, cannot be cleared
+ !!! /*TODO*/ 0;
+ }
+ };
+
+}}} // namespace boost::geometry::traits
+
+
+
 typedef boost::geometry::multi_polygon<boost::geometry::polygon_2d> country_type;
 
 
@@ -296,7 +322,7 @@
 
         // Create a string and set it in the status text
         std::ostringstream out;
- out << "Position: " << point.x() << ", " << point.y() << " " << m_focus << " " << previous_focus;
+ out << "Position: " << point.x() << ", " << point.y();
         m_owner->SetStatusText(wxString(out.str().c_str(), wxConvUTF8));
     }
 }
@@ -362,7 +388,7 @@
 
         std::size_t n = boost::size(poly.outer());
 
- boost::scoped_ptr<wxPoint> points(new wxPoint[n]);
+ boost::scoped_array<wxPoint> points(new wxPoint[n]);
 
         bg::transform(poly.outer(),
                     std::make_pair(points.get(), points.get() + n),


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