Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-26 08:34:30

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2024 Barend Gehrels, Amsterdam, the Netherlands.
0004 
0005 // Use, modification and distribution is subject to the Boost Software License,
0006 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 #ifndef BOOST_GEOMETRY_UTIL_NUMERIC_CAST_HPP
0010 #define BOOST_GEOMETRY_UTIL_NUMERIC_CAST_HPP
0011 
0012 #include <boost/numeric/conversion/cast.hpp>
0013 
0014 namespace boost { namespace geometry { namespace util
0015 
0016 {
0017 
0018 #ifndef DOXYGEN_NO_DETAIL
0019 namespace detail
0020 {
0021 
0022 /// brief calls numeric cast
0023 template <typename Target, typename Source>
0024 struct numeric_caster
0025 {
0026     static inline Target apply(Source const& source)
0027     {
0028         return boost::numeric_cast<Target>(source);
0029     }
0030 };
0031 
0032 } // namespace detail
0033 #endif
0034 
0035 // Calls either boost::numeric_cast, or functionality specific for Boost.Geometry
0036 // (such as rational_cast for Boost.Rational)
0037 template <typename Target, typename Source>
0038 inline Target numeric_cast(Source const& source)
0039 {
0040     return detail::numeric_caster<Target, Source>::apply(source);
0041 }
0042 
0043 }}} // namespace boost::geometry::util
0044 
0045 #endif // BOOST_GEOMETRY_UTIL_NUMERIC_CAST_HPP