Skip to content

Commit cfe7146

Browse files
committed
wip
1 parent 297cf39 commit cfe7146

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

src/internal_type_traits.rs

+63
Original file line numberDiff line numberDiff line change
@@ -1 +1,64 @@
1+
use std::{
2+
fmt,
3+
iter::{Product, Sum},
4+
ops::{
5+
Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Div,
6+
DivAssign, Mul, MulAssign, Not, Rem, RemAssign, Shl, ShlAssign, Shr, ShrAssign, Sub,
7+
SubAssign,
8+
},
9+
};
110

11+
// Skipped:
12+
//
13+
// - `is_signed_int_t<T>` (probably won't be used directly in `modint.rs`)
14+
// - `is_unsigned_int_t<T>` (probably won't be used directly in `modint.rs`)
15+
// - `to_unsigned_t<T>` (not used in `fenwicktree.rs`)
16+
17+
// We will remove unnecessary bounds later.
18+
19+
/// Corresponds to `std::is_integral` in C++.
20+
pub(crate) trait Integral:
21+
'static
22+
+ Send
23+
+ Sync
24+
+ Copy
25+
+ Ord
26+
+ Not<Output = Self>
27+
+ Add<Output = Self>
28+
+ Sub<Output = Self>
29+
+ Mul<Output = Self>
30+
+ Div<Output = Self>
31+
+ Rem<Output = Self>
32+
+ AddAssign
33+
+ SubAssign
34+
+ MulAssign
35+
+ DivAssign
36+
+ RemAssign
37+
+ Sum
38+
+ Product
39+
+ BitOr<Output = Self>
40+
+ BitAnd<Output = Self>
41+
+ BitXor<Output = Self>
42+
+ BitOrAssign
43+
+ BitAndAssign
44+
+ BitXorAssign
45+
+ Shl<Output = Self>
46+
+ Shr<Output = Self>
47+
+ ShlAssign
48+
+ ShrAssign
49+
+ fmt::Display
50+
+ fmt::Debug
51+
+ fmt::Binary
52+
+ fmt::Octal
53+
{
54+
}
55+
56+
macro_rules! impl_integral {
57+
($($ty:ty),*) => {
58+
$(
59+
impl Integral for $ty {}
60+
)*
61+
};
62+
}
63+
64+
impl_integral!(i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize);

0 commit comments

Comments
 (0)