1 | #include <bitset> |
---|---|
2 | #include <stdio.h> |
3 | |
4 | template <std::size_t N> void fill(std::bitset<N> &b) { |
5 | b.set(); |
6 | b[0] = b[1] = false; |
7 | for (std::size_t i = 2; i < N; ++i) { |
8 | for (std::size_t j = 2 * i; j < N; j += i) |
9 | b[j] = false; |
10 | } |
11 | } |
12 | |
13 | template <std::size_t N> |
14 | void by_ref_and_ptr(std::bitset<N> &ref, std::bitset<N> *ptr) { |
15 | // Check ref and ptr |
16 | return; |
17 | } |
18 | |
19 | int main() { |
20 | std::bitset<0> empty; |
21 | std::bitset<13> small; |
22 | fill(b&: small); |
23 | std::bitset<70> medium; |
24 | fill(b&: medium); |
25 | std::bitset<1000> large; |
26 | fill(b&: large); |
27 | by_ref_and_ptr(ref&: small, ptr: &small); // break here |
28 | by_ref_and_ptr(ref&: medium, ptr: &medium); |
29 | by_ref_and_ptr(ref&: large, ptr: &large); |
30 | return 0; |
31 | } |
32 |