私は次の機能を持っています:
std::vector<double>residuals;
std::cout << Print_res(std::cout);
std::ostream& Print_res(std::ostream& os) const {
os << "\tresidual" << std::endl;
for (unsigned int i = 0 ; i < 22 ; i++) {
os << "\t\t" << residuals[i] << std::endl;
}
os << std::flush;
return os;
};
残差は正しく出力されますが、出力タグの最後に次のようなアドレスが表示されます。
2275
2279.08
2224.0835
0x80c5604
どうすればこれを修正できますか? 編集:みんなのコメントを読んだ後、関数の呼び出しを as に置き換えPrint_res
ましstd::copy
た
std::copy(residuals.begin(), residuals.end(), std::ostream_iterator<double>(std::cout,"\n"));
それはアドレスを出力しなかったので、関数を書いた方法に何か問題があると思います。