|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55987 - sandbox/gtl/boost/polygon
From: lucanus.j.simonson_at_[hidden]
Date: 2009-09-03 00:10:18
Author: ljsimons
Date: 2009-09-03 00:10:17 EDT (Thu, 03 Sep 2009)
New Revision: 55987
URL: http://svn.boost.org/trac/boost/changeset/55987
Log:
improve genericity of the boolean to support floating and exact coordinate types
Text files modified:
sandbox/gtl/boost/polygon/isotropy.hpp | 145 ++++++++++++++++++++-------------------
1 files changed, 74 insertions(+), 71 deletions(-)
Modified: sandbox/gtl/boost/polygon/isotropy.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/isotropy.hpp (original)
+++ sandbox/gtl/boost/polygon/isotropy.hpp 2009-09-03 00:10:17 EDT (Thu, 03 Sep 2009)
@@ -124,6 +124,76 @@
POLYGON_SET_CONCEPT
};
+
+#ifndef BOOST_POLYGON_NO_DEPS
+ struct gtl_no : mpl::bool_<false> {};
+ struct gtl_yes : mpl::bool_<true> {};
+ template <typename T, typename T2>
+ struct gtl_and : mpl::and_<T, T2> {};
+ template <typename T, typename T2, typename T3>
+ struct gtl_and_3 : mpl::and_<T, T2, T3> {};
+ template <typename T, typename T2, typename T3, typename T4>
+ struct gtl_and_4 : mpl::and_<T, T2, T3, T4> {};
+// template <typename T, typename T2>
+// struct gtl_or : mpl::or_<T, T2> {};
+// template <typename T, typename T2, typename T3>
+// struct gtl_or_3 : mpl::or_<T, T2, T3> {};
+// template <typename T, typename T2, typename T3, typename T4>
+// struct gtl_or_4 : mpl::or_<T, T2, T3, T4> {};
+#else
+ struct gtl_no { static const bool value = false; };
+ struct gtl_yes { typedef gtl_yes type;
+ static const bool value = true; };
+
+ template <bool T, bool T2>
+ struct gtl_and_c { typedef gtl_no type; };
+ template <>
+ struct gtl_and_c<true, true> { typedef gtl_yes type; };
+
+ template <typename T, typename T2>
+ struct gtl_and : gtl_and_c<T::value, T2::value> {};
+ template <typename T, typename T2, typename T3>
+ struct gtl_and_3 { typedef typename gtl_and<
+ T, typename gtl_and<T2, T3>::type>::type type; };
+
+ template <typename T, typename T2, typename T3, typename T4>
+ struct gtl_and_4 { typedef typename gtl_and_3<
+ T, T2, typename gtl_and<T3, T4>::type>::type type; };
+#endif
+ template <typename T, typename T2>
+ struct gtl_or { typedef gtl_yes type; };
+ template <typename T>
+ struct gtl_or<T, T> { typedef T type; };
+
+ template <typename T, typename T2, typename T3>
+ struct gtl_or_3 { typedef typename gtl_or<
+ T, typename gtl_or<T2, T3>::type>::type type; };
+
+ template <typename T, typename T2, typename T3, typename T4>
+ struct gtl_or_4 { typedef typename gtl_or<
+ T, typename gtl_or_3<T2, T3, T4>::type>::type type; };
+
+ template <typename T>
+ struct gtl_not { typedef gtl_no type; };
+ template <>
+ struct gtl_not<gtl_no> { typedef gtl_yes type; };
+
+ template <typename T>
+ struct gtl_if {
+#ifdef WIN32
+ typedef gtl_no type;
+#endif
+ };
+ template <>
+ struct gtl_if<gtl_yes> { typedef gtl_yes type; };
+
+ template <typename T, typename T2>
+ struct gtl_same_type { typedef gtl_no type; };
+ template <typename T>
+ struct gtl_same_type<T, T> { typedef gtl_yes type; };
+ template <typename T, typename T2>
+ struct gtl_different_type { typedef typename gtl_not<typename gtl_same_type<T, T2>::type>::type type; };
+
struct undefined_concept {};
template <typename T>
@@ -157,6 +227,7 @@
typedef long coordinate_difference;
#endif
typedef long double coordinate_distance;
+ typedef gtl_yes is_integer_type;
};
#ifdef BOOST_POLYGON_USE_LONG_LONG
@@ -168,6 +239,7 @@
typedef polygon_ulong_long_type unsigned_area_type;
typedef polygon_long_long_type coordinate_difference;
typedef long double coordinate_distance;
+ typedef gtl_yes is_integer_type;
};
#endif
@@ -179,6 +251,7 @@
typedef float unsigned_area_type;
typedef float coordinate_difference;
typedef float coordinate_distance;
+ typedef gtl_no is_integer_type;
};
template <>
@@ -189,6 +262,7 @@
typedef double unsigned_area_type;
typedef double coordinate_difference;
typedef double coordinate_distance;
+ typedef gtl_no is_integer_type;
};
template <typename T>
@@ -216,75 +290,6 @@
template <>
struct geometry_concept<double> { typedef coordinate_concept type; };
-#ifndef BOOST_POLYGON_NO_DEPS
- struct gtl_no : mpl::bool_<false> {};
- struct gtl_yes : mpl::bool_<true> {};
- template <typename T, typename T2>
- struct gtl_and : mpl::and_<T, T2> {};
- template <typename T, typename T2, typename T3>
- struct gtl_and_3 : mpl::and_<T, T2, T3> {};
- template <typename T, typename T2, typename T3, typename T4>
- struct gtl_and_4 : mpl::and_<T, T2, T3, T4> {};
-// template <typename T, typename T2>
-// struct gtl_or : mpl::or_<T, T2> {};
-// template <typename T, typename T2, typename T3>
-// struct gtl_or_3 : mpl::or_<T, T2, T3> {};
-// template <typename T, typename T2, typename T3, typename T4>
-// struct gtl_or_4 : mpl::or_<T, T2, T3, T4> {};
-#else
- struct gtl_no { static const bool value = false; };
- struct gtl_yes { typedef gtl_yes type;
- static const bool value = true; };
-
- template <bool T, bool T2>
- struct gtl_and_c { typedef gtl_no type; };
- template <>
- struct gtl_and_c<true, true> { typedef gtl_yes type; };
-
- template <typename T, typename T2>
- struct gtl_and : gtl_and_c<T::value, T2::value> {};
- template <typename T, typename T2, typename T3>
- struct gtl_and_3 { typedef typename gtl_and<
- T, typename gtl_and<T2, T3>::type>::type type; };
-
- template <typename T, typename T2, typename T3, typename T4>
- struct gtl_and_4 { typedef typename gtl_and_3<
- T, T2, typename gtl_and<T3, T4>::type>::type type; };
-#endif
- template <typename T, typename T2>
- struct gtl_or { typedef gtl_yes type; };
- template <typename T>
- struct gtl_or<T, T> { typedef T type; };
-
- template <typename T, typename T2, typename T3>
- struct gtl_or_3 { typedef typename gtl_or<
- T, typename gtl_or<T2, T3>::type>::type type; };
-
- template <typename T, typename T2, typename T3, typename T4>
- struct gtl_or_4 { typedef typename gtl_or<
- T, typename gtl_or_3<T2, T3, T4>::type>::type type; };
-
- template <typename T>
- struct gtl_not { typedef gtl_no type; };
- template <>
- struct gtl_not<gtl_no> { typedef gtl_yes type; };
-
- template <typename T>
- struct gtl_if {
-#ifdef WIN32
- typedef gtl_no type;
-#endif
- };
- template <>
- struct gtl_if<gtl_yes> { typedef gtl_yes type; };
-
- template <typename T, typename T2>
- struct gtl_same_type { typedef gtl_no type; };
- template <typename T>
- struct gtl_same_type<T, T> { typedef gtl_yes type; };
- template <typename T, typename T2>
- struct gtl_different_type { typedef typename gtl_not<typename gtl_same_type<T, T2>::type>::type type; };
-
struct manhattan_domain {};
struct forty_five_domain {};
struct general_domain {};
@@ -310,8 +315,6 @@
return (lvalue < rvalue) ? (Unit)rvalue - (Unit)lvalue : (Unit)lvalue - (Unit)rvalue;
}
-
-
// predicated_swap swaps a and b if pred is true
// predicated_swap is guarenteed to behave the same as
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