How to append a char to a std::string?

后端 未结 13 2098
半阙折子戏
半阙折子戏 2020-11-29 15:58

The following fails with the error prog.cpp:5:13: error: invalid conversion from ‘char’ to ‘const char*’

int main()
{
  char d = \'d\';
  std::s         


        
相关标签:
13条回答
  • 2020-11-29 16:23

    Try using the d as pointer y.append(*d)

    0 讨论(0)
提交回复
热议问题