Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82473 - trunk/boost/geometry/io/wkt
From: bruno.lalande_at_[hidden]
Date: 2013-01-13 06:57:46


Author: bruno.lalande
Date: 2013-01-13 06:57:45 EST (Sun, 13 Jan 2013)
New Revision: 82473
URL: http://svn.boost.org/trac/boost/changeset/82473

Log:
Made dispatch::wkt able to retrieve the tag by itself + used not_implemented.
Text files modified:
   trunk/boost/geometry/io/wkt/write.hpp | 33 ++++++++++++---------------------
   1 files changed, 12 insertions(+), 21 deletions(-)

Modified: trunk/boost/geometry/io/wkt/write.hpp
==============================================================================
--- trunk/boost/geometry/io/wkt/write.hpp (original)
+++ trunk/boost/geometry/io/wkt/write.hpp 2013-01-13 06:57:45 EST (Sun, 13 Jan 2013)
@@ -18,12 +18,12 @@
 #include <string>
 
 #include <boost/array.hpp>
-#include <boost/concept/assert.hpp>
 #include <boost/range.hpp>
 #include <boost/typeof/typeof.hpp>
 
 #include <boost/geometry/algorithms/assign.hpp>
 #include <boost/geometry/algorithms/convert.hpp>
+#include <boost/geometry/algorithms/not_implemented.hpp>
 #include <boost/geometry/core/exterior_ring.hpp>
 #include <boost/geometry/core/interior_rings.hpp>
 #include <boost/geometry/core/ring_type.hpp>
@@ -240,18 +240,12 @@
 namespace dispatch
 {
 
-template <typename Tag, typename Geometry>
-struct wkt
-{
- BOOST_MPL_ASSERT_MSG
- (
- false, NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
- , (types<Geometry>)
- );
-};
+template <typename Geometry, typename Tag = typename tag<Geometry>::type>
+struct wkt: not_implemented<Tag>
+{};
 
 template <typename Point>
-struct wkt<point_tag, Point>
+struct wkt<Point, point_tag>
     : detail::wkt::wkt_point
         <
             Point,
@@ -260,7 +254,7 @@
 {};
 
 template <typename Linestring>
-struct wkt<linestring_tag, Linestring>
+struct wkt<Linestring, linestring_tag>
     : detail::wkt::wkt_range
         <
             Linestring,
@@ -275,12 +269,12 @@
 It is therefore streamed as a polygon
 */
 template <typename Box>
-struct wkt<box_tag, Box>
+struct wkt<Box, box_tag>
     : detail::wkt::wkt_box<Box>
 {};
 
 template <typename Segment>
-struct wkt<segment_tag, Segment>
+struct wkt<Segment, segment_tag>
     : detail::wkt::wkt_segment<Segment>
 {};
 
@@ -291,7 +285,7 @@
 It is therefore streamed as a polygon
 */
 template <typename Ring>
-struct wkt<ring_tag, Ring>
+struct wkt<Ring, ring_tag>
     : detail::wkt::wkt_range
         <
             Ring,
@@ -304,7 +298,7 @@
 \brief Specialization to stream polygon as WKT
 */
 template <typename Polygon>
-struct wkt<polygon_tag, Polygon>
+struct wkt<Polygon, polygon_tag>
     : detail::wkt::wkt_poly
         <
             Polygon,
@@ -312,6 +306,7 @@
>
 {};
 
+
 } // namespace dispatch
 #endif // DOXYGEN_NO_DISPATCH
 
@@ -340,11 +335,7 @@
             std::basic_ostream<Char, Traits>& os,
             wkt_manipulator const& m)
     {
- dispatch::wkt
- <
- typename tag<Geometry>::type,
- Geometry
- >::apply(os, m.m_geometry);
+ dispatch::wkt<Geometry>::apply(os, m.m_geometry);
         os.flush();
         return os;
     }


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