回答編集履歴

2

ソース修正

2020/02/26 04:39

投稿

cateye
cateye

スコア6851

test CHANGED
@@ -18,15 +18,13 @@
18
18
 
19
19
  #include <bit>
20
20
 
21
- #include <cstdint>
22
-
23
21
  //
24
22
 
25
23
  int main( )
26
24
 
27
25
  {
28
26
 
29
- auto a = static_cast<std::uint32_t>(0b111000);
27
+ uint32_t a = 0b111000;
30
28
 
31
29
  std::cout << std::popcount(a) << "\n";
32
30
 

1

ソース追記

2020/02/26 04:39

投稿

cateye
cateye

スコア6851

test CHANGED
@@ -1,3 +1,39 @@
1
- ```#include <bit>```
1
+ `#include <bit>
2
2
 
3
3
  が必要です。
4
+
5
+
6
+
7
+ 結果(clang 10)
8
+
9
+ ```text
10
+
11
+ usr ~/Project/test % ./a.out
12
+
13
+ 3
14
+
15
+ usr ~/Project/test % cat t1.cpp
16
+
17
+ #include <iostream>
18
+
19
+ #include <bit>
20
+
21
+ #include <cstdint>
22
+
23
+ //
24
+
25
+ int main( )
26
+
27
+ {
28
+
29
+ auto a = static_cast<std::uint32_t>(0b111000);
30
+
31
+ std::cout << std::popcount(a) << "\n";
32
+
33
+
34
+
35
+ return 0;
36
+
37
+ }
38
+
39
+ ```