From cdaba1bebbb7cf4afa12c476f892933ca78492fd Mon Sep 17 00:00:00 2001 From: Bruno Lalande Date: Tue, 13 Dec 2011 23:24:52 +0000 Subject: [PATCH] Improved not_implemented. [SVN r75935] --- .../tools/support_status/support_status.cpp | 6 +- include/boost/geometry/algorithms/convert.hpp | 4 +- .../boost/geometry/algorithms/distance.hpp | 5 +- .../geometry/algorithms/not_implemented.hpp | 81 ++++++++++++++++++- 4 files changed, 86 insertions(+), 10 deletions(-) diff --git a/doc/src/docutils/tools/support_status/support_status.cpp b/doc/src/docutils/tools/support_status/support_status.cpp index 5bd3f0640..df14199fa 100644 --- a/doc/src/docutils/tools/support_status/support_status.cpp +++ b/doc/src/docutils/tools/support_status/support_status.cpp @@ -66,8 +66,8 @@ struct distance_tester typedef typename boost::geometry::tag::type tag1; typedef typename boost::geometry::tag::type tag2; - if (boost::is_base_of, check_distance >::type::value - && boost::is_base_of, check_distance >::type::value) + if (boost::is_base_of >::type::value + && boost::is_base_of >::type::value) { std::cout << "-\t"; } @@ -96,7 +96,7 @@ struct convert_tester template void operator()(T2) { - if (boost::is_base_of, check_convert >::type::value) + if (boost::is_base_of >::type::value) { std::cout << "-\t"; } diff --git a/include/boost/geometry/algorithms/convert.hpp b/include/boost/geometry/algorithms/convert.hpp index fe58064d2..526dc9c9f 100644 --- a/include/boost/geometry/algorithms/convert.hpp +++ b/include/boost/geometry/algorithms/convert.hpp @@ -220,7 +220,9 @@ template bool UseAssignment = boost::is_same::value && !boost::is_array::value > -struct convert: boost::geometry::not_implemented +struct convert: boost::geometry::not_implemented, + and_geometry, + in_dimension > {}; diff --git a/include/boost/geometry/algorithms/distance.hpp b/include/boost/geometry/algorithms/distance.hpp index de8c9e85d..09340b6b5 100644 --- a/include/boost/geometry/algorithms/distance.hpp +++ b/include/boost/geometry/algorithms/distance.hpp @@ -247,11 +247,12 @@ using strategy::distance::services::return_type; template < - typename GeometryTag1, typename GeometryTag2, + typename Tag1, typename Tag2, typename Geometry1, typename Geometry2, typename StrategyTag, typename Strategy > -struct distance: not_implemented +struct distance: not_implemented, + and_geometry > {}; diff --git a/include/boost/geometry/algorithms/not_implemented.hpp b/include/boost/geometry/algorithms/not_implemented.hpp index b21643b74..3699cd305 100644 --- a/include/boost/geometry/algorithms/not_implemented.hpp +++ b/include/boost/geometry/algorithms/not_implemented.hpp @@ -17,25 +17,98 @@ #include +#include +#include +#include +#include namespace boost { namespace geometry { +// Class containing the elements of the actual user-facing error message + +template +struct FOR_GEOMETRY_TYPE +{ + template + struct AND_GEOMETRY_TYPE + { + template + struct IN_DIMENSION + {}; + }; + + template + struct IN_DIMENSION + {}; +}; + + +// Unary metafunction class templates which return their corresponding error +// message element nested in the previous one. + +template +struct for_geometry +{ + template + struct apply + { + typedef FOR_GEOMETRY_TYPE type; + }; +}; + +template +struct and_geometry +{ + template + struct apply + { + typedef typename Prev::template AND_GEOMETRY_TYPE type; + }; +}; + +template +struct in_dimension +{ + template + struct apply + { + typedef typename Prev::template IN_DIMENSION type; + }; +}; + + #ifndef BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD # define BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD false #endif -template -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) + THIS_OPERATION_IS_NOT_OR_NOT_YET_IMPLEMENTED, + ( + typename boost::mpl::fold< + typename boost::mpl::remove< + boost::mpl::vector, + void + >::type, + void, + boost::mpl::apply_wrap1 + >::type + ) ); };