#author("2017-12-08T23:01:54+09:00","default:wikiwriter","wikiwriter") &tag(STL); *目次 [#bdadd8bb] #contents *関連ページ [#y92d400d] *参考情報 [#zc2e0334] *トラブルシューティング [#o6dc5399] **「string subscript out of range error」が発生する。 [#de3455ae] -空文字列に対するインデックスアクセスはC++3から不定となったらしい。https://stackoverflow.com/questions/347949/how-to-convert-a-stdstring-to-const-char-or-char #pre{{ &x[0] -for empty strings this has undefined behaviour (21.3.4) e.g. given f(const char* p, size_t n) { if (n == 0) return; ...whatever... } you mustn't call f(&x[0], x.size()); when x.empty() - just use f(x.data(), ...). -otherwise, as per x.data() but: for non-const x this yields a non-const char* pointer; you can overwrite string content }}