今日在一个项目上排查问题时,找到一个关于empty()函数误写为empty,导致出现了错误
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- string s = "abc";
- if(s.empty)
- {
- cout << "it is empty string" << endl;
- }
- else
- {
- cout << "not empty string" << endl;
- }
- return 0;
- }
看来写代码还是要认真的,不能有半点马虎。好了,今天周五,也要下班了,赶紧吃点饭。