Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
単一のコマンドで次のことを行う方法はありますか (テストを回避するため)
if (mystring.find_first_not_of("X") != std::string::npos) { mystring.erase(0, mystring.find_first_not_of("X")); }
mystring.erase(0, std::max(0, (std::make_signed<std::string::size_type>::type) mystring.find_first_not_of('X')));
またはC++11なし:
mystring.erase(0, std::max(0, (int)mystring.find_first_not_of('X')));