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

質問編集履歴

2

解決

2018/10/22 13:28

投稿

opyon
opyon

スコア1009

title CHANGED
File without changes
body CHANGED
@@ -1,3 +1,11 @@
1
+ ###解決!
2
+ @LouiS0616さん回答より
3
+ [std::cbegin](https://cpprefjp.github.io/reference/iterator/cbegin.html)
4
+ ```
5
+ std::string src = "aabbcc";
6
+ std::count(src.cbegin(), src.cend(), 'a')
7
+ ```
8
+
1
9
  ###質問の経緯や現状
2
10
  ・std::stringにcountがあると思ったら無いので調べるとstd::countでカウント出来そう
3
11
  ・std::countはコンテナ型に適用できる

1

環境追記

2018/10/22 13:28

投稿

opyon
opyon

スコア1009

title CHANGED
File without changes
body CHANGED
@@ -39,4 +39,7 @@
39
39
 
40
40
  // 出力結果
41
41
  // 2
42
- ```
42
+ ```
43
+
44
+ ###環境
45
+ ※コンパイラはC++14です