From 4987e8d13d2b3f1fa6b86f85f0909823a278bb28 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 10 Mar 2014 03:02:11 +0100 Subject: [PATCH] relate() implemented support for complex static masks as a MPL sequences --- .../algorithms/detail/relate/result.hpp | 117 +++++++++++++++++- 1 file changed, 113 insertions(+), 4 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/relate/result.hpp b/include/boost/geometry/algorithms/detail/relate/result.hpp index 8a7f2b154..d2d9c08bc 100644 --- a/include/boost/geometry/algorithms/detail/relate/result.hpp +++ b/include/boost/geometry/algorithms/detail/relate/result.hpp @@ -395,8 +395,8 @@ struct static_should_handle_element || ( mask_el >= '0' && mask_el <= '9' ); }; -template -struct static_interrupt +template +struct static_interrupt_dispatch { static const char mask_el = StaticMask::template get::value; @@ -406,8 +406,58 @@ struct static_interrupt ( ( V == 'T' ) ? mask_el == 'F' : false ); }; -template -struct static_check +template +struct static_interrupt_sequence +{ + typedef typename boost::mpl::deref::type StaticMask; + + static const bool value + = static_interrupt_dispatch + < + StaticMask, + V, F1, F2, + !boost::mpl::is_sequence::value + >::value + && static_interrupt_sequence + < + typename boost::mpl::next::type, + Last, + V, F1, F2 + >::value; +}; + +template +struct static_interrupt_sequence +{ + static const bool value = true; +}; + +template +struct static_interrupt_dispatch +{ + static const bool value + = static_interrupt_sequence + < + typename boost::mpl::begin::type, + typename boost::mpl::end::type, + V, F1, F2 + >::value; +}; + +template +struct static_interrupt +{ + static const bool value + = static_interrupt_dispatch + < + StaticMask, + V, F1, F2, + !boost::mpl::is_sequence::value + >::value; +}; + +template +struct static_check_dispatch { template static inline bool apply(Matrix const& matrix) @@ -463,6 +513,65 @@ struct static_check }; }; +template +struct static_check_sequence +{ + typedef typename boost::mpl::deref::type StaticMask; + + template + static inline bool apply(Matrix const& matrix) + { + return static_check_dispatch + < + StaticMask, + !boost::mpl::is_sequence::value + >::apply(matrix) + || static_check_sequence + < + typename boost::mpl::next::type, + Last + >::apply(matrix); + } +}; + +template +struct static_check_sequence +{ + template + static inline bool apply(Matrix const& matrix) + { + return false; + } +}; + +template +struct static_check_dispatch +{ + template + static inline bool apply(Matrix const& matrix) + { + return static_check_sequence + < + typename boost::mpl::begin::type, + typename boost::mpl::end::type + >::apply(matrix); + } +}; + +template +struct static_check +{ + template + static inline bool apply(Matrix const& matrix) + { + return static_check_dispatch + < + StaticMask, + !boost::mpl::is_sequence::value + >::apply(matrix); + } +}; + template class static_mask_handler : private matrix<3>