Using C++11, Ubuntu 14.04, GCC default toolchain. This code fails: constexpr std::string constString = "constString"; error: the type ‘const string {aka const std::basic_string}’ of constexpr variable ‘constString’ is not...
  • May 23, 2022
  • 0 Comments
I need to use an std::string to store data retrieved by fgets(). To do this I need to convert the char* return value from fgets() into an std::string to...
  • May 14, 2022
  • 0 Comments
I thought this would be really simple, but it’s presenting some difficulties. If I have std::string name = "John"; int age = 21; How do I combine them to...
  • April 25, 2022
  • 0 Comments
I’m currently using the following code to right-trim all the std::strings in my programs: std::string s; s.erase(s.find_last_not_of(" \n\r\t")+1); It works fine, but I wonder if there are some end-cases...
  • April 17, 2022
  • 0 Comments