Improved not_implemented.

[SVN r75935]
This commit is contained in:
Bruno Lalande
2011-12-13 23:24:52 +00:00
parent 39584eeb8c
commit cdaba1bebb
4 changed files with 86 additions and 10 deletions

View File

@@ -66,8 +66,8 @@ struct distance_tester
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 @@ struct convert_tester
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";
}

View File

@@ -220,7 +220,9 @@ template
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> >
{};

View File

@@ -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<Geometry1, Geometry2>
struct distance: not_implemented<for_geometry<Tag1>,
and_geometry<Tag2> >
{};

View File

@@ -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
)
);
};