Answers for "C++ drop last element of list"

C++
0

C++ drop last element of list

std::string res;  // sample
// do things
  if (res.size() > 0 ) res.pop_back();
  return res;  // typical next instruction
// alternative
  return res.substr(0, res.size() - 1);
Posted by: Guest on May-01-2021

Browse Popular Code Answers by Language