diff --git a/test/util/reversible_closeable.cpp b/test/util/reversible_closeable.cpp index f638816ce..39759c562 100644 --- a/test/util/reversible_closeable.cpp +++ b/test/util/reversible_closeable.cpp @@ -5,7 +5,6 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#define _HAS_ITERATOR_DEBUGGING 0 #include #include @@ -23,21 +22,16 @@ #include -template -void test_option(Range const& range, std::string const& expected) +template +void test_option(View const& view, std::string const& expected) { - View const view(range); bool first = true; std::ostringstream out; typedef typename boost::range_iterator::type iterator; - ////std::cout << typeid(iterator).name() << std::endl; - - // The commented case below crashes here in specific circumstances: iterator end = boost::end(view); - for (iterator it = boost::begin(view); it != end; ++it, first = false) { out << (first ? "" : " ") << bg::dsv(*it); @@ -48,28 +42,25 @@ void test_option(Range const& range, std::string const& expected) template void test_close_reverse(Range const& range, std::string const& expected) { - test_option - < - typename bg::closeable_view - < - typename bg::reversible_view::type const, - Closure - >::type - >(range, expected); + typedef typename bg::reversible_view::type rview; + typedef typename bg::closeable_view::type cview; + + rview view1(range); + cview view2(view1); + + test_option(view2, expected); } -template +template void test_reverse_close(Range const& range, std::string const& expected) { - test_option - < - typename bg::reversible_view - < - typename bg::closeable_view::type const, - Direction - >::type - >(range, expected); + typedef typename bg::closeable_view::type cview; + typedef typename bg::reversible_view::type rview; + + cview view1(range); + rview view2(view1); + test_option(view2, expected); } @@ -81,32 +72,28 @@ template > void test_reverse_reverse(Range const& range, std::string const& expected) { - test_option - < - typename bg::reversible_view - < - typename bg::reversible_view::type const, - Direction1 - >::type - >(range, expected); + typedef typename bg::reversible_view::type rview1; + typedef typename bg::reversible_view::type rview2; + + rview1 view1(range); + rview2 view2(view1); + test_option(view2, expected); } template < - bg::closure_selector Close1, - bg::closure_selector Close2, + bg::closure_selector Closure1, + bg::closure_selector Closure2, typename Range > void test_close_close(Range const& range, std::string const& expected) { - test_option - < - typename bg::closeable_view - < - typename bg::closeable_view::type const, - Close1 - >::type - >(range, expected); + typedef typename bg::closeable_view::type cview1; + typedef typename bg::closeable_view::type cview2; + + cview1 view1(range); + cview2 view2(view1); + test_option(view2, expected); } @@ -126,20 +113,9 @@ void test_geometry(std::string const& wkt, test_close_reverse(geo, expected_n + closing); test_close_reverse(geo, expected_r); -#if ! defined(_MSC_VER) || ! defined(_HAS_ITERATOR_DEBUGGING) - // 13-12-2010, Currently problematic in MSVC - // I've got no idea why this is. - // 1) if I go back to the original versions (without reverse_range / metafunctions, as in boost-geometry-0.7.0) - // the problem DISAPPEARS. - // 2) if I use the original version of closeable_view, but the shortened version of reversible_view - // (with typedef Range type and typedef reversed_range type) the problem IS MUCH LARGER - // 3) if I use the shortened versions (so new versions of closeable and reversible_view), - // it is only in the next "test_close_reverse" - // Runtime Exception Message: "vector iterators incompatible" - // Tested in MSVC 2005 and MSVC 2010. In GCC no problems detected. - // If I define _HAS_ITERATOR_DEBUGGING, the problem "disappears" + // 13-12-2010, this case was problematic in MSVC + // SOLVED: caused by IMPLICIT constructor! It is now explicit and should be kept like that. test_close_reverse(geo, expected_r + rclosing); -#endif test_reverse_close(geo, expected_n); test_reverse_close(geo, expected_n + closing);