File indexing completed on 2025-12-16 09:44:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_COMPUTE_DETAIL_LITERAL_HPP
0012 #define BOOST_COMPUTE_DETAIL_LITERAL_HPP
0013
0014 #include <iomanip>
0015 #include <limits>
0016 #include <sstream>
0017
0018 #include <boost/type_traits/is_same.hpp>
0019
0020 #include <boost/compute/types/fundamental.hpp>
0021
0022 namespace boost {
0023 namespace compute {
0024 namespace detail {
0025
0026 template<class T>
0027 std::string make_literal(T x)
0028 {
0029 std::stringstream s;
0030 s << std::setprecision(
0031 #ifndef BOOST_NO_CXX11_NUMERIC_LIMITS
0032 std::numeric_limits<T>::max_digits10
0033 #else
0034
0035
0036 3 + std::numeric_limits<T>::digits10
0037 #endif
0038 )
0039 << std::scientific
0040 << x;
0041
0042 if(boost::is_same<T, float>::value || boost::is_same<T, float_>::value){
0043 s << "f";
0044 }
0045
0046 return s.str();
0047 }
0048
0049 }
0050 }
0051 }
0052
0053 #endif