Added commented out specializations of insexable<>, equal_to<> and tests for std::tuple.

Removed unneeded variant node get<> function.

[SVN r83302]
This commit is contained in:
Adam Wulkiewicz
2013-03-05 02:42:02 +00:00
parent 14f606d158
commit 6fc96171f8
4 changed files with 140 additions and 10 deletions

View File

@@ -37,16 +37,6 @@ inline V & get(
return boost::get<V>(v);
}
template <typename V, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
inline V * get(
boost::variant<
static_leaf<Value, Parameters, Box, Allocators, Tag>,
static_internal_node<Value, Parameters, Box, Allocators, Tag>
> *v)
{
return boost::get<V>(v);
}
// apply visitor
template <typename Visitor, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>

View File

@@ -123,4 +123,56 @@ struct equal_to< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
}}} // namespace boost::geometry::index
//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
//
//#include <tuple>
//
//namespace boost { namespace geometry { namespace index {
//
//namespace detail {
//
//template <typename Tuple, size_t I, size_t N>
//struct std_tuple_equals
//{
// inline static bool apply(Tuple const& t1, Tuple const& t2)
// {
// typedef typename std::tuple_element<I, Tuple>::type T;
// return
// equals<
// T, typename geometry::traits::tag<T>::type
// >::apply(std::get<I>(t1), std::get<I>(t2))
// &&
// std_tuple_equals<Tuple, I+1, N>::apply(t1, t2);
// }
//};
//
//template <typename Tuple, size_t I>
//struct std_tuple_equals<Tuple, I, I>
//{
// inline static bool apply(Tuple const&, Tuple const&)
// {
// return true;
// }
//};
//
//} // namespace detail
//
//template <typename ...Args>
//struct equal_to< std::tuple<Args...> >
//{
// typedef std::tuple<Args...> value_type;
//
// typedef bool result_type;
// bool operator()(value_type const& l, value_type const& r) const
// {
// return detail::std_tuple_equals<
// value_type, 0, std::tuple_size<value_type>::value
// >::apply(l ,r);
// }
//};
//
//}}} // namespace boost::geometry::index
//
//#endif // !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#endif // BOOST_GEOMETRY_INDEX_EQUAL_TO_HPP

View File

@@ -109,4 +109,32 @@ struct indexable< boost::tuple<Indexable, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
}}} // namespace boost::geometry::index
//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
//
//#include <tuple>
//
//namespace boost { namespace geometry { namespace index {
//
//template <typename Indexable, typename ...Args>
//struct indexable< std::tuple<Indexable, Args...> >
//{
// typedef std::tuple<Indexable, Args...> value_type;
//
// BOOST_MPL_ASSERT_MSG(
// (detail::is_indexable<Indexable>::value),
// NOT_VALID_INDEXABLE_TYPE,
// (Indexable)
// );
//
// typedef Indexable const& result_type;
// result_type operator()(value_type const& v) const
// {
// return std::get<0>(v);
// }
//};
//
//}}} // namespace boost::geometry::index
//
//#endif // !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#endif // BOOST_GEOMETRY_INDEX_INDEXABLE_HPP

View File

@@ -196,6 +196,56 @@ struct generate_value< boost::tuple<bg::model::box< bg::model::point<T, 3, C> >,
}
};
//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
//
//template <typename T, typename C>
//struct generate_value< std::tuple<bg::model::point<T, 2, C>, int, int> >
//{
// typedef bg::model::point<T, 2, C> P;
// typedef std::tuple<P, int, int> R;
// static R apply(int x, int y)
// {
// return std::make_tuple(P(x, y), x + y * 100, 0);
// }
//};
//
//template <typename T, typename C>
//struct generate_value< std::tuple<bg::model::box< bg::model::point<T, 2, C> >, int, int> >
//{
// typedef bg::model::point<T, 2, C> P;
// typedef bg::model::box<P> B;
// typedef std::tuple<B, int, int> R;
// static R apply(int x, int y)
// {
// return std::make_tuple(B(P(x, y), P(x + 2, y + 3)), x + y * 100, 0);
// }
//};
//
//template <typename T, typename C>
//struct generate_value< std::tuple<bg::model::point<T, 3, C>, int, int> >
//{
// typedef bg::model::point<T, 3, C> P;
// typedef std::tuple<P, int, int> R;
// static R apply(int x, int y, int z)
// {
// return std::make_tuple(P(x, y, z), x + y * 100 + z * 10000, 0);
// }
//};
//
//template <typename T, typename C>
//struct generate_value< std::tuple<bg::model::box< bg::model::point<T, 3, C> >, int, int> >
//{
// typedef bg::model::point<T, 3, C> P;
// typedef bg::model::box<P> B;
// typedef std::tuple<B, int, int> R;
// static R apply(int x, int y, int z)
// {
// return std::make_tuple(B(P(x, y, z), P(x + 2, y + 3, z + 4)), x + y * 100 + z * 10000, 0);
// }
//};
//
//#endif // #if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
// shared_ptr value
template <typename Indexable>
@@ -1346,6 +1396,11 @@ void test_rtree_for_point(Parameters const& parameters, Allocator const& allocat
test_rtree_count<Point>(parameters, allocator);
test_rtree_bounds<Point>(parameters, allocator);
//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
// typedef std::tuple<Point, int, int> StdTupleP;
// test_rtree_by_value<StdTupleP, Parameters>(parameters, allocator);
//#endif
}
template<typename Point, typename Parameters, typename Allocator>
@@ -1366,6 +1421,11 @@ void test_rtree_for_box(Parameters const& parameters, Allocator const& allocator
test_rtree_count<Box>(parameters, allocator);
test_rtree_bounds<Box>(parameters, allocator);
//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
// typedef std::tuple<Box, int, int> StdTupleB;
// test_rtree_by_value<StdTupleB, Parameters>(parameters, allocator);
//#endif
}
template<typename Point, typename Parameters>