2013-09-11 21:14:32

在VS下运行正确的代码,拿到VC6.0下,编译出错,提示:

 error C2039: 'push_back' : is not a member of 'basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'

在网上查了一下,好像是VC6.0对STL支持不是很好,在http://cboard.cprogramming.com/cplusplus-programming/76579-back_inserter-string.html的帖子中,看到用+=不会出错,试了一下,果然如此。

而且,push_back、insert、append在VC6.0下都不行,+=可以:

 

1     //sum.push_back(tmpSum + '0');
2         //sum.insert(tmpSum + '0');
3         //sum.append(tmpSum + '0');
4         sum += (tmpSum + '0');

 

相关文章:

  • 2021-11-14
  • 2022-12-23
  • 2021-12-04
  • 2021-11-01
  • 2022-12-23
  • 2021-10-20
  • 2021-11-07
猜你喜欢
  • 2022-01-02
  • 2021-05-25
  • 2021-09-04
  • 2021-11-18
  • 2021-09-18
  • 2021-06-30
相关资源
相似解决方案