2014-06-10から1日間の記事一覧

stringstreamのstr()メンバ関数は、バッファの消費に関係なく全ての文字列を返す

C++

ちょっと嵌ってた。 std::stringstream::str()メンバ関数は、事前にバッファを消費しても、消費に関係なく全文字列を返すようです。 #include <iostream> #include <sstream> int main() { std::istringstream ss("0123456789"); const std::size_t N = 3; char buffer[N + 1] =</sstream></iostream>…