Chris@16: // Boost.Geometry Index Chris@16: // Chris@16: // n-dimensional content (hypervolume) - 2d area, 3d volume, ... Chris@16: // Chris@101: // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. Chris@16: // Chris@16: // Use, modification and distribution is subject to the Boost Software License, Chris@16: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP Chris@16: #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP Chris@16: Chris@16: namespace boost { namespace geometry { namespace index { namespace detail { Chris@16: Chris@16: template Chris@16: struct default_content_result Chris@16: { Chris@16: typedef typename select_most_precise< Chris@16: typename coordinate_type::type, Chris@16: long double Chris@16: >::type type; Chris@16: }; Chris@16: Chris@16: namespace dispatch { Chris@16: Chris@101: template ::value> Chris@16: struct content_box Chris@16: { Chris@16: BOOST_STATIC_ASSERT(0 < CurrentDimension); Chris@16: Chris@16: static inline typename detail::default_content_result::type apply(Box const& b) Chris@16: { Chris@16: return content_box::apply(b) * Chris@16: ( get(b) - get(b) ); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct content_box Chris@16: { Chris@16: static inline typename detail::default_content_result::type apply(Box const& b) Chris@16: { Chris@16: return get(b) - get(b); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct content Chris@16: { Chris@16: BOOST_MPL_ASSERT_MSG(false, NOT_IMPLEMENTED_FOR_THIS_INDEXABLE_AND_TAG, (Indexable, Tag)); Chris@16: }; Chris@16: Chris@16: template Chris@16: struct content Chris@16: { Chris@16: static typename detail::default_content_result::type apply(Indexable const&) Chris@16: { Chris@16: return 0; Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct content Chris@16: { Chris@16: static typename default_content_result::type apply(Indexable const& b) Chris@16: { Chris@101: return dispatch::content_box::apply(b); Chris@16: } Chris@16: }; Chris@16: Chris@16: } // namespace dispatch Chris@16: Chris@16: template Chris@16: typename default_content_result::type content(Indexable const& b) Chris@16: { Chris@101: return dispatch::content Chris@101: < Chris@101: Indexable, Chris@101: typename tag::type Chris@101: >::apply(b); Chris@16: } Chris@16: Chris@16: }}}} // namespace boost::geometry::index::detail Chris@16: Chris@16: #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP