some toods
This commit is contained in:
parent
d207769de9
commit
2e30696e49
3 changed files with 4 additions and 0 deletions
|
|
@ -51,6 +51,7 @@ class mint {
|
|||
}
|
||||
|
||||
[[nodiscard]] constexpr mint operator/(mint const other) const noexcept {
|
||||
// TODO: if consteval
|
||||
if constexpr (other.get() == 0) {
|
||||
static_assert(false, "Cannot divide by 0");
|
||||
} else if (other.get() == 0) {
|
||||
|
|
@ -96,6 +97,7 @@ class mint {
|
|||
return *this;
|
||||
}
|
||||
|
||||
// TODO: check this
|
||||
constexpr mint operator++(int) noexcept {
|
||||
auto _this = *this;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ class Eratosthenes : public Sieve<Eratosthenes<Limit>, Limit> {
|
|||
|
||||
[[nodiscard]] constexpr bool operator[](size_t const number) const {
|
||||
if consteval {
|
||||
// TODO: does/can this run at compile time?
|
||||
if (number > Limit) {
|
||||
throw std::out_of_range(
|
||||
std::format("cannot determine primality of {} > size of sieve {}",
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ TEST(SieveTest, BasicConstruction) { Eratosthenes<100> sieve; }
|
|||
TEST(SieveTest, ValidateAgainstNaive) {
|
||||
Eratosthenes<1000> sieve;
|
||||
|
||||
// TODO: assert done at compile time
|
||||
for (size_t i = 0; i <= 1000; ++i) {
|
||||
EXPECT_EQ(sieve[i], naive_prime(i))
|
||||
<< "Sieve disagrees with naive checker for " << i;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue