teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

ソース修正

2020/02/26 04:39

投稿

cateye
cateye

スコア6851

answer CHANGED
@@ -8,11 +8,10 @@
8
8
  usr ~/Project/test % cat t1.cpp
9
9
  #include <iostream>
10
10
  #include <bit>
11
- #include <cstdint>
12
11
  //
13
12
  int main( )
14
13
  {
15
- auto a = static_cast<std::uint32_t>(0b111000);
14
+ uint32_t a = 0b111000;
16
15
  std::cout << std::popcount(a) << "\n";
17
16
 
18
17
  return 0;

1

ソース追記

2020/02/26 04:39

投稿

cateye
cateye

スコア6851

answer CHANGED
@@ -1,2 +1,20 @@
1
- ```#include <bit>```
1
+ `#include <bit>
2
- が必要です。
2
+ が必要です。
3
+
4
+ 結果(clang 10)
5
+ ```text
6
+ usr ~/Project/test % ./a.out
7
+ 3
8
+ usr ~/Project/test % cat t1.cpp
9
+ #include <iostream>
10
+ #include <bit>
11
+ #include <cstdint>
12
+ //
13
+ int main( )
14
+ {
15
+ auto a = static_cast<std::uint32_t>(0b111000);
16
+ std::cout << std::popcount(a) << "\n";
17
+
18
+ return 0;
19
+ }
20
+ ```