Re: My formal review of int128
Matt Borland via Boost <[email protected]> Mon, 27 Jul 2026 18:23:04 +0000
| Newsgroups | gmane.comp.lib.boost.devel |
|---|---|
| Message-ID | <gLk-OwQZr8mgnULM28TIbeTemkkUmDPPhZcKHmmyjlKJ3Csx80VDcnl37BERs2vchHy-J3aiJxMq2-K9vhNXwXRd8DTXwLM2zy5GuoXSAL8=@mattborland.com> |
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--===============1143059062161006287==
Content-Type: multipart/signed; protocol="application/pgp-signature";
micalg=pgp-sha512;
boundary="------b9e2c12e2888a49902eb3cd40eb20a7f504d218829d5d04a90e7e359b842fe29";
charset=utf-8
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--------b9e2c12e2888a49902eb3cd40eb20a7f504d218829d5d04a90e7e359b842fe29
Content-Type: multipart/mixed;boundary=---------------------3452aee964270cbb90f67051074150bf
-----------------------3452aee964270cbb90f67051074150bf
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;charset=utf-8
> =
> The one thing that bothers me is that all of the std-equivalent
> functions are placed in the int128 namespace, which makes it harder to
> write generic code. Instead of this:
> =
> auto f(auto i) { return std::has_single_bit(i); }
> =
> I now have to write this instead:
> =
> auto f(auto i) {
> using namespace std;
> return has_single_bit(i); // use ADL
> }
> =
> This is annoying. I wish there was a function somewhere like this:
> =
> // not in some_namespace to prevent infinite recursion
> namespace some_namespace_detail {
> =
> auto impl_has_single_bit(auto i) {
> using namespace std;
> return has_single_bit(i);
> }
> =
> }
> =
> namespace some_namespace {
> =
> auto has_single_bit(auto i) {
> return some_namespace_detail::impl_has_single_bit(i);
> }
> =
> }
> =
> That way I could write my function like this, without using a using
> directive:
> =
> auto f(auto i) { return some_namespace::has_single_bit(i); }
> =
> However, that seems to be outside the scope of boost::int128.
> =
Perhaps one day a proposal like P4188 (wg21.link/p4188) will allow us to d=
o so inside of std. I agree it is rather annoying. Boost.Math has BOOST_MA=
TH_STD_INCLUDE which expands to basically all of the cmath functions which=
is a bit better than having to write a bunch of using std::whatever; at t=
he top of a function. =
> =
> My verdict: ACCEPT unconditionally.
> =
Thank you for the review Rainer!
Matt
-----------------------3452aee964270cbb90f67051074150bf
Content-Type: application/pgp-keys; filename="publickey - [email protected] - 0xC1382EAD.asc"; name="publickey - [email protected] - 0xC1382EAD.asc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="publickey - [email protected] - 0xC1382EAD.asc"; name="publickey - [email protected] - 0xC1382EAD.asc"
LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgp4ak1FWDJ3Z2RCWUpLd1lCQkFI
YVJ3OEJBUWRBVUhPaDBLcGJaQ3N6aGR2S3p0V2o0QzZGUjFvek1CUUUKd2FCaTNtMlBKSExOSzIx
aGRIUkFiV0YwZEdKdmNteGhibVF1WTI5dElEeHRZWFIwUUcxaGRIUmliM0pzCllXNWtMbU52YlQ3
Q2p3UVFGZ29BSUFVQ1gyd2dkQVlMQ1FjSUF3SUVGUWdLQWdRV0FnRUFBaGtCQWhzRApBaDRCQUNF
SkVGbUJXbFZDRmFXbEZpRUV3VGd1clRjb0h3YmRTYklzV1lGYVZVSVZwYVZXdXdFQTc3cm0KT0E0
VEI2WHhlNnE4Z0k0MmJFSUNNaE15WktTTWNha3ozOS9kallrQkFNSk9HK0lHUUMvZDBuM2RzbDEw
CktnL294WDg4a0ZPMW9QS240L1hXK1RvQnpqZ0VYMndnZEJJS0t3WUJCQUdYVlFFRkFRRUhRT3Nt
bzZ3UgpVdVhSQXZGSWlxbVFrellyUHl2S1lLbmEyejRadG1uVFFNa01Bd0VJQjhKNEJCZ1dDQUFK
QlFKZmJDQjAKQWhzTUFDRUpFRm1CV2xWQ0ZhV2xGaUVFd1RndXJUY29Id2JkU2JJc1dZRmFWVUlW
cGFXVUp3RUE1RzBjClpSbkc1V0dORXJJK3k5MGlRclR2MDJpNEl2aHY3dHdvRmNMRC96d0Evakt5
cHcrdmVoRTk5bUVqMS91SQpFa29ERmxOelFacU5sZGJqUmNQeUk1VUgKPTQ2MlMKLS0tLS1FTkQg
UEdQIFBVQkxJQyBLRVkgQkxPQ0stLS0tLQo=
-----------------------3452aee964270cbb90f67051074150bf--
--------b9e2c12e2888a49902eb3cd40eb20a7f504d218829d5d04a90e7e359b842fe29
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: ProtonMail
wrsEARYKAG0FgmpnofsJEFmBWlVCFaWlRRQAAAAAABwAIHNhbHRAbm90YXRp
b25zLm9wZW5wZ3Bqcy5vcmclzmKeeuS4mize8H9ECy9qFK2usmggdCjPWUOy
85MZ6hYhBME4Lq03KB8G3UmyLFmBWlVCFaWlAAD2hAEA6QYTBV2pfePK7wzd
z035lsWYRmCrfckFkwz2eGmFam0A/0pZ9prlECwhkAovH1xYvX1Fj+g7kF8y
b9G9o/pef84L
=j2gO
-----END PGP SIGNATURE-----
--------b9e2c12e2888a49902eb3cd40eb20a7f504d218829d5d04a90e7e359b842fe29--
--===============1143059062161006287==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Boost mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.boost.org/mailman3/lists/boost.lists.boost.org/
Archived at: https://lists.boost.org/archives/list/[email protected]/message/LJJFCPCQTYX657NOMWDLWY63MPI3BBZU/
--===============1143059062161006287==--