計算幾何学と計算機科学の区別はどうにかならんのか?
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
@anqou C++20 (n4868) §7.6.1.9/10
https://timsong-cpp.github.io/cppwp/n4868/expr.static.cast#10
> If the enumeration type has a fixed underlying type, the value is first converted to that type by integral conversion, if necessary, and then to the enumeration type.
If the enumeration type does not have a fixed underlying type, the value is unchanged if the original value is within the range of the enumeration values ([dcl.enum]), and otherwise, the behavior is undefined.
ここに該当して未定義動作ですね
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1766
ははー、 C++11/14 では unspecified だったのが undefined になったんか
This account is not set to public on notestock.
これちょっと気になって調べてたけど、やっぱりさっき挙げた節に該当しない気がしてきたんだよな
This account is not set to public on notestock.
これは歴史的経緯によるところと、計算量的な困難によるところと、原理的な困難によるところがあるので、ケースバイケースで論じていかないといけない
たとえば配列の範囲外アクセスはあらゆる配列アクセスにおいて添字の確認を行えば……と思うかもしれないがそれは甘くて、一度生ポインタを経由して長さ情報が失われたら原理的に範囲外かどうか確認できないじゃん、など
や、これも厳密にはちょっと違って外側からゴテゴテと検査機構を入れてやると不可能とまでは言えないんだけど、パフォーマンスが数十倍とか数百倍落ちることは覚悟しないといけない
実行時にしかわからないものもあるので、一般にはコンパイルエラーではなく実行時チェックと実行時エラーを入れることになる
std::byte - cppreference.com
https://en.cppreference.com/w/cpp/types/byte
さっきのやつ <https://mstdn.anqou.net/@anqou/107190942386550421>、構図としては std::byte とほぼ同じなので、 -1 を bool に変化した true にならないとおかしい気がするんだよな……