|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71349 - in trunk: boost/geometry/geometries/adapted libs/geometry/test/geometries
From: bruno.lalande_at_[hidden]
Date: 2011-04-17 05:55:17
Author: bruno.lalande
Date: 2011-04-17 05:55:12 EDT (Sun, 17 Apr 2011)
New Revision: 71349
URL: http://svn.boost.org/trac/boost/changeset/71349
Log:
Generalized Boost.Tuple adaptation to nD.
Text files modified:
trunk/boost/geometry/geometries/adapted/tuple.hpp | 89 ++++++++++++---------------------------
trunk/boost/geometry/geometries/adapted/tuple_cartesian.hpp | 14 +++---
trunk/boost/geometry/geometries/adapted/tuple_geographic.hpp | 14 +++---
trunk/libs/geometry/test/geometries/Jamfile.v2 | 3 +
trunk/libs/geometry/test/geometries/adapted.cpp | 9 ++-
5 files changed, 50 insertions(+), 79 deletions(-)
Modified: trunk/boost/geometry/geometries/adapted/tuple.hpp
==============================================================================
--- trunk/boost/geometry/geometries/adapted/tuple.hpp (original)
+++ trunk/boost/geometry/geometries/adapted/tuple.hpp 2011-04-17 05:55:12 EDT (Sun, 17 Apr 2011)
@@ -32,95 +32,60 @@
namespace traits
{
-// boost::tuple, 2D
-template <typename CoordinateType>
-struct coordinate_type<boost::tuple<CoordinateType, CoordinateType> >
-{
- typedef CoordinateType type;
-};
-
-
-template <typename CoordinateType>
-struct dimension<boost::tuple<CoordinateType, CoordinateType> >
- : boost::mpl::int_<2>
-{};
-
-template <typename CoordinateType, std::size_t Dimension>
-struct access
- <
- boost::tuple<CoordinateType, CoordinateType>,
- Dimension
- >
-{
- static inline CoordinateType get(
- boost::tuple<CoordinateType, CoordinateType> const& point)
- {
- return point.template get<Dimension>();
- }
-
- static inline void set(boost::tuple<CoordinateType, CoordinateType>& point,
- CoordinateType const& value)
- {
- point.template get<Dimension>() = value;
- }
-};
-
-
-template <typename CoordinateType>
-struct tag<boost::tuple<CoordinateType, CoordinateType> >
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10>
+struct tag<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >
{
typedef point_tag type;
};
-// boost::tuple, 3D
-template <typename CoordinateType>
-struct coordinate_type
- <
- boost::tuple<CoordinateType, CoordinateType, CoordinateType>
- >
-{
- typedef CoordinateType type;
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10>
+struct coordinate_type<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >
+{
+ typedef T1 type;
};
-template <typename CoordinateType>
-struct dimension<boost::tuple<CoordinateType, CoordinateType, CoordinateType> >
- : boost::mpl::int_<3>
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10>
+struct dimension<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >
+ : boost::mpl::int_
+ <
+ boost::tuples::length
+ <
+ boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
+ >::value
+ >
{};
-template <typename CoordinateType, std::size_t Dimension>
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ std::size_t Dimension>
struct access
<
- boost::tuple<CoordinateType, CoordinateType, CoordinateType>,
+ boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>,
Dimension
>
{
- static inline CoordinateType get(
- boost::tuple
- <
- CoordinateType, CoordinateType, CoordinateType
- > const& point)
+ static inline T1 get(
+ boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> const& point)
{
return point.template get<Dimension>();
}
static inline void set(
- boost::tuple<CoordinateType, CoordinateType, CoordinateType>& point,
- CoordinateType const& value)
+ boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& point,
+ T1 const& value)
{
point.template get<Dimension>() = value;
}
};
-template <typename CoordinateType>
-struct tag<boost::tuple<CoordinateType, CoordinateType, CoordinateType> >
-{
- typedef point_tag type;
-};
-
// The library user has
// 1) either to specify the coordinate system using a traits class
// 2) or include <boost/geometry/geometries/adapted/tuple__at_.hpp>
Modified: trunk/boost/geometry/geometries/adapted/tuple_cartesian.hpp
==============================================================================
--- trunk/boost/geometry/geometries/adapted/tuple_cartesian.hpp (original)
+++ trunk/boost/geometry/geometries/adapted/tuple_cartesian.hpp 2011-04-17 05:55:12 EDT (Sun, 17 Apr 2011)
@@ -31,13 +31,13 @@
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
namespace traits
{
- template <typename T>
- struct coordinate_system<boost::tuple<T, T> >
- { typedef cs::cartesian type; };
-
- template <typename T>
- struct coordinate_system<boost::tuple<T, T, T> >
- { typedef cs::cartesian type; };
+
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10>
+struct coordinate_system<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >
+{ typedef cs::cartesian type; };
+
}
#endif
Modified: trunk/boost/geometry/geometries/adapted/tuple_geographic.hpp
==============================================================================
--- trunk/boost/geometry/geometries/adapted/tuple_geographic.hpp (original)
+++ trunk/boost/geometry/geometries/adapted/tuple_geographic.hpp 2011-04-17 05:55:12 EDT (Sun, 17 Apr 2011)
@@ -31,13 +31,13 @@
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
namespace traits
{
- template <typename T>
- struct coordinate_system<boost::tuple<T, T> >
- { typedef cs::geographic<degree> type; };
-
- template <typename T>
- struct coordinate_system<boost::tuple<T, T, T> >
- { typedef cs::geographic<degree> type; };
+
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10>
+struct coordinate_system<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >
+{ typedef cs::geographic<degree> type; };
+
}
#endif
Modified: trunk/libs/geometry/test/geometries/Jamfile.v2
==============================================================================
--- trunk/libs/geometry/test/geometries/Jamfile.v2 (original)
+++ trunk/libs/geometry/test/geometries/Jamfile.v2 2011-04-17 05:55:12 EDT (Sun, 17 Apr 2011)
@@ -10,10 +10,13 @@
test-suite boost-geometry-geometries
:
+ [ run adapted.cpp ]
[ run boost_array_as_point.cpp ]
[ run boost_fusion.cpp ]
[ run boost_polygon.cpp ]
[ run boost_range.cpp ]
+ [ run boost_tuple_cartesian.cpp ]
+ [ run boost_tuple_geographic.cpp ]
[ run box.cpp ]
#[ compile-fail custom_linestring.cpp
# : # requirements
Modified: trunk/libs/geometry/test/geometries/adapted.cpp
==============================================================================
--- trunk/libs/geometry/test/geometries/adapted.cpp (original)
+++ trunk/libs/geometry/test/geometries/adapted.cpp 2011-04-17 05:55:12 EDT (Sun, 17 Apr 2011)
@@ -93,15 +93,18 @@
int test_main(int, char* [])
{
-/* test_all<test::test_point>();
+ test_all<test::test_point>();
test_all<boost::tuple<float, float> >();
test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
test_all<bg::model::point<long double, 2, bg::cs::cartesian> >();
-*/
+
+ test_all<boost::tuple<float, float, float> >();
test_all<bg::model::point<double, 3, bg::cs::cartesian> >();
- //test_all<bg::model::point<long double, 3, bg::cs::cartesian> >();
+ test_all<bg::model::point<long double, 3, bg::cs::cartesian> >();
+
+ test_all<boost::tuple<float, float, float, float, float> >();
return 0;
}
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