#include <iostream> /* C++ iostream C++98/11 */
#include <string> /* C++ strings C++98/11 */
#include <boost/regex.hpp> /* RegEx Boost */
#include <boost/algorithm/string.hpp>
int main() {
std::string str = "\\dir\\dir2\\dir4\\dir4\\dir6";
auto itr = boost::find_nth(str, "\\", 4);
if(itr.empty()) std::cout << "empty";
}
I2luY2x1ZGUgPGlvc3RyZWFtPiAgICAgICAgICAgICAgICAvKiBDKysgaW9zdHJlYW0gICAgICAgICAgICBDKys5OC8xMSAqLwojaW5jbHVkZSA8c3RyaW5nPiAgICAgICAgICAgICAgICAgIC8qIEMrKyBzdHJpbmdzICAgICAgICAgICAgIEMrKzk4LzExICovCiNpbmNsdWRlIDxib29zdC9yZWdleC5ocHA+ICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogUmVnRXggICAgICAgICAgICAgICAgICAgQm9vc3QgICovCiNpbmNsdWRlIDxib29zdC9hbGdvcml0aG0vc3RyaW5nLmhwcD4KaW50IG1haW4oKSB7CglzdGQ6OnN0cmluZyBzdHIgPSAiXFxkaXJcXGRpcjJcXGRpcjRcXGRpcjRcXGRpcjYiOwphdXRvIGl0ciA9IGJvb3N0OjpmaW5kX250aChzdHIsICJcXCIsIDQpOwppZihpdHIuZW1wdHkoKSkgc3RkOjpjb3V0IDw8ICJlbXB0eSI7CgoKfQo=