1. std::endl
cout, cerr经常用的std::endl如果用到ofstream上来换行,就悲剧了....因为它会导致flush...
所以还是用'\n'吧。
2. tellg
看上去tellg只是告诉读指针的当前位置,但是,如果频繁调用,你会发现读性能糟透了!
为什么呢?我也不清楚...或许跟tellg是调用seekg(0, std::ios_base::cur)来实现的有关?
感兴趣的可以看下这个:http://bytes.com/topic/c/answers/604830-complexity-tellg