Skip to content

Commit 95a6273

Browse files
committed
add operator bool to modint
Signed-off-by: szdytom <szdytom@qq.com>
1 parent d8ca7f2 commit 95a6273

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

atcoder/modint.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ struct static_modint : internal::static_modint_base {
9191

9292
mint operator+() const { return *this; }
9393
mint operator-() const { return mint() - *this; }
94+
operator bool() const { return _v == 0; }
9495

9596
mint pow(long long n) const {
9697
assert(0 <= n);
@@ -206,6 +207,7 @@ template <int id> struct dynamic_modint : internal::modint_base {
206207

207208
mint operator+() const { return *this; }
208209
mint operator-() const { return mint() - *this; }
210+
operator bool() const { return _v == 0; }
209211

210212
mint pow(long long n) const {
211213
assert(0 <= n);

0 commit comments

Comments
 (0)