From: Boost-users <boost-users-boun...@lists.boost.org> On Behalf Of A.Dmitrovsky via Boost-users Sent: 15 May 2020 11:03 To: boost-users@lists.boost.org Cc: A.Dmitrovsky <td...@yandex.ru> Subject: [Boost-users] [Multiprecision] number conversion to __int128
Hi, Boost::multiprecision docs [1] mentions that the type parameter of number::convert_to method should be "fundamental", pointing to the list of standard types ('A number can be converted to any https://en.cppreference.com/w/cpp/language/types type)'. This is different to number::convert_to reference [2], which states that "Type T may be any arithmetic type". Can [unsigned] __int128 be treated as "fundamental" on compilers/platforms which support it? [1] https://www.boost.org/doc/libs/1_73_0/libs/multiprecision/doc/html/boost_multiprecision/tut/conversions.html [2] https://www.boost.org/doc/libs/1_73_0/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html Does “ *Interconversions between number types of the same family are allowed and are implicit conversions if no loss of precision is involved, and explicit if it is: … " In https://www.boost.org/doc/libs/1_73_0/libs/multiprecision/doc/html/boost_multiprecision/tut/conversions.html Not cover your case _uint128 ? and thus allowed for conversion. Even if the _uint* and _int* types are not fundamental builtin types (regrettably - blame the glacial process of C and C++ standardization and the millstone of C (don't ask) - but they might as well be for most purposes, including this one). HTH Paul _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users