fork download
  1. #include <iostream> /* C++ iostream C++98/11 */
  2. #include <string> /* C++ strings C++98/11 */
  3. #include <boost/regex.hpp> /* RegEx Boost */
  4. #include <boost/algorithm/string.hpp>
  5. int main() {
  6. std::string str = "\\dir\\dir2\\dir4\\dir4\\dir6";
  7. auto itr = boost::find_nth(str, "\\", 4);
  8. if(itr.empty()) std::cout << "empty";
  9.  
  10.  
  11. }
  12.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty