根本的な疑問なんですけども急に気になり始めまして、STLのmapで
size_type erase(const key_type& k);
これって何を返すの?って話です。
どうも戻り値をみる限り、map中で消去した要素数を返している感じに見えた。
ソース。
/** * @brief Erases elements according to the provided key. * @param x Key of element to be erased. * @return The number of elements erased. * * This function erases all the elements located by the given key from * a %map. * Note that this function only erases the element, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibilty. */ size_type erase(const key_type& __x) { return _M_t.erase(__x); }
ソースのコメントをみるときっちりと消した要素数を返すよ!と書いてあるんですけど、いちいちソース開いてコメント読んで確認するのがちょっとメンドい。
c++についてよく思ってたんですけど、、なんかman形式のファイルでも良いし、boostとかJavaのドキュメントみたいな感じでもいいし、このあたりのことがバッチリかいてあるものってないんですか?
一番情報あるのってここ?