|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67187 - sandbox/geometry/libs/geometry/test/util
From: barend.gehrels_at_[hidden]
Date: 2010-12-12 10:48:46
Author: barendgehrels
Date: 2010-12-12 10:48:45 EST (Sun, 12 Dec 2010)
New Revision: 67187
URL: http://svn.boost.org/trac/boost/changeset/67187
Log:
-Made closeable_view and reversible_view metafunctions, defining itself or a Boost.Range reversed_range or a closing_view
Text files modified:
sandbox/geometry/libs/geometry/test/util/closeable_view.cpp | 4 ++--
sandbox/geometry/libs/geometry/test/util/reversible_view.cpp | 34 +++++++++++++++++++++++++++++++---
2 files changed, 33 insertions(+), 5 deletions(-)
Modified: sandbox/geometry/libs/geometry/test/util/closeable_view.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/util/closeable_view.cpp (original)
+++ sandbox/geometry/libs/geometry/test/util/closeable_view.cpp 2010-12-12 10:48:45 EST (Sun, 12 Dec 2010)
@@ -28,7 +28,7 @@
typedef bg::closeable_view
<
std::vector<int> const, true
- > view_type;
+ >::type view_type;
std::vector<int> v;
v.push_back(1);
@@ -79,7 +79,7 @@
template <bool Close, typename Range>
void test_optionally_closing(Range const& range, std::string const& expected)
{
- typedef bg::closeable_view<Range const, Close> view_type;
+ typedef bg::closeable_view<Range const, Close>::type view_type;
typedef typename boost::range_iterator<view_type const>::type iterator;
view_type view(range);
Modified: sandbox/geometry/libs/geometry/test/util/reversible_view.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/util/reversible_view.cpp (original)
+++ sandbox/geometry/libs/geometry/test/util/reversible_view.cpp 2010-12-12 10:48:45 EST (Sun, 12 Dec 2010)
@@ -14,20 +14,36 @@
#include <boost/geometry/util/reversible_view.hpp>
-#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
#include <boost/geometry/util/write_dsv.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
+namespace boost { namespace geometry
+{
+
+namespace traits
+{
+
+template<typename Geometry>
+struct tag<boost::range_detail::reverse_range<Geometry> >
+{
+ typedef typename geometry::tag<Geometry>::type type;
+};
+
+}
+
+}}
+
template <bg::iterate_direction Direction, typename Range>
void test_forward_or_reverse(Range const& range, std::string const& expected)
{
- typedef bg::reversible_view
+ typedef typename bg::reversible_view
<
Range const,
Direction
- > view_type;
+ >::type view_type;
view_type view(range);
@@ -58,8 +74,20 @@
template <typename P>
+void test_range_adaptor()
+{
+ bg::model::linestring<P> ls;
+ bg::read_wkt("linestring(1 1,2 2,3 3, 4 4)", ls);
+ std::cout << bg::wkt(ls) << std::endl;
+ std::cout << bg::wkt(ls | boost::adaptors::reversed) << std::endl;
+ std::cout << bg::wkt(boost::range_detail::reverse_range<bg::model::linestring<P> >(ls)) << std::endl;
+}
+
+
+template <typename P>
void test_all()
{
+ //test_range_adaptor<P>();
test_geometry<bg::model::linestring<P> >(
"linestring(1 1,2 2,3 3)",
"(1, 1) (2, 2) (3, 3)",
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