Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75935 - in trunk: boost/geometry/algorithms libs/geometry/doc/src/docutils/tools/support_status
From: bruno.lalande_at_[hidden]
Date: 2011-12-13 18:24:55


Author: bruno.lalande
Date: 2011-12-13 18:24:52 EST (Tue, 13 Dec 2011)
New Revision: 75935
URL: http://svn.boost.org/trac/boost/changeset/75935

Log:
Improved not_implemented.
Text files modified:
   trunk/boost/geometry/algorithms/convert.hpp | 4 +
   trunk/boost/geometry/algorithms/distance.hpp | 5 +
   trunk/boost/geometry/algorithms/not_implemented.hpp | 81 ++++++++++++++++++++++++++++++++++++++-
   trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp | 6 +-
   4 files changed, 86 insertions(+), 10 deletions(-)

Modified: trunk/boost/geometry/algorithms/convert.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/convert.hpp (original)
+++ trunk/boost/geometry/algorithms/convert.hpp 2011-12-13 18:24:52 EST (Tue, 13 Dec 2011)
@@ -220,7 +220,9 @@
     bool UseAssignment = boost::is_same<Geometry1, Geometry2>::value
                          && !boost::is_array<Geometry1>::value
>
-struct convert: boost::geometry::not_implemented<Geometry1, Geometry2>
+struct convert: boost::geometry::not_implemented<for_geometry<Tag1>,
+ and_geometry<Tag2>,
+ in_dimension<DimensionCount> >
 {};
 
 

Modified: trunk/boost/geometry/algorithms/distance.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/distance.hpp (original)
+++ trunk/boost/geometry/algorithms/distance.hpp 2011-12-13 18:24:52 EST (Tue, 13 Dec 2011)
@@ -247,11 +247,12 @@
 
 template
 <
- typename GeometryTag1, typename GeometryTag2,
+ typename Tag1, typename Tag2,
     typename Geometry1, typename Geometry2,
     typename StrategyTag, typename Strategy
>
-struct distance: not_implemented<Geometry1, Geometry2>
+struct distance: not_implemented<for_geometry<Tag1>,
+ and_geometry<Tag2> >
 {};
 
 

Modified: trunk/boost/geometry/algorithms/not_implemented.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/not_implemented.hpp (original)
+++ trunk/boost/geometry/algorithms/not_implemented.hpp 2011-12-13 18:24:52 EST (Tue, 13 Dec 2011)
@@ -17,25 +17,98 @@
 
 
 #include <boost/mpl/assert.hpp>
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/remove.hpp>
+#include <boost/mpl/apply_wrap.hpp>
 
 
 namespace boost { namespace geometry
 {
 
 
+// Class containing the elements of the actual user-facing error message
+
+template <class>
+struct FOR_GEOMETRY_TYPE
+{
+ template <class>
+ struct AND_GEOMETRY_TYPE
+ {
+ template <size_t>
+ struct IN_DIMENSION
+ {};
+ };
+
+ template <size_t>
+ struct IN_DIMENSION
+ {};
+};
+
+
+// Unary metafunction class templates which return their corresponding error
+// message element nested in the previous one.
+
+template <class G>
+struct for_geometry
+{
+ template <class>
+ struct apply
+ {
+ typedef FOR_GEOMETRY_TYPE<G> type;
+ };
+};
+
+template <class G>
+struct and_geometry
+{
+ template <class Prev>
+ struct apply
+ {
+ typedef typename Prev::template AND_GEOMETRY_TYPE<G> type;
+ };
+};
+
+template <size_t D>
+struct in_dimension
+{
+ template <class Prev>
+ struct apply
+ {
+ typedef typename Prev::template IN_DIMENSION<D> type;
+ };
+};
+
+
 #ifndef BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD
 # define BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD false
 #endif
 
 
-template <typename Geometry1, typename Geometry2>
-struct not_implemented
+struct not_implemented_base {};
+
+
+template <
+ typename Word1 = void,
+ typename Word2 = void,
+ typename Word3 = void
+>
+struct not_implemented: not_implemented_base
 {
     BOOST_MPL_ASSERT_MSG
         (
             BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD,
- NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
- , (types<Geometry1, Geometry2>)
+ THIS_OPERATION_IS_NOT_OR_NOT_YET_IMPLEMENTED,
+ (
+ typename boost::mpl::fold<
+ typename boost::mpl::remove<
+ boost::mpl::vector<Word1, Word2, Word3>,
+ void
+ >::type,
+ void,
+ boost::mpl::apply_wrap1<boost::mpl::_2, boost::mpl::_1>
+ >::type
+ )
         );
 };
 

Modified: trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp
==============================================================================
--- trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp (original)
+++ trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp 2011-12-13 18:24:52 EST (Tue, 13 Dec 2011)
@@ -66,8 +66,8 @@
         typedef typename boost::geometry::tag<T1>::type tag1;
         typedef typename boost::geometry::tag<T2>::type tag2;
 
- if (boost::is_base_of<boost::geometry::not_implemented<T1, T2>, check_distance<tag1, tag2, T1, T2> >::type::value
- && boost::is_base_of<boost::geometry::not_implemented<T2, T1>, check_distance<tag2, tag1, T2, T1> >::type::value)
+ if (boost::is_base_of<boost::geometry::not_implemented_base, check_distance<tag1, tag2, T1, T2> >::type::value
+ && boost::is_base_of<boost::geometry::not_implemented_base, check_distance<tag2, tag1, T2, T1> >::type::value)
         {
             std::cout << "-\t";
         }
@@ -96,7 +96,7 @@
     template <typename T2>
     void operator()(T2)
     {
- if (boost::is_base_of<boost::geometry::not_implemented<T1, T2>, check_convert<T1, T2> >::type::value)
+ if (boost::is_base_of<boost::geometry::not_implemented_base, check_convert<T1, T2> >::type::value)
         {
             std::cout << "-\t";
         }


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