begin()==end() for an empty path
path(p),
start(0)
{
- if(path.path[0]==DIRCHAR)
+ if(path.path.empty())
+ start=end=string::npos;
+ else if(path.path[0]==DIRCHAR)
end=1;
#ifdef WIN32
- else if(path.path[2]==DIRCHAR && is_windows_drive(path.path.substr(0,2)))
+ else if(path.path.size()>2 && path.path[2]==DIRCHAR && is_windows_drive(path.path.substr(0,2)))
end=2;
#endif
else
Path(const std::string &p) { init(p); }
Path(const char *p) { init(p); }
const std::string &str() const { return path; }
- unsigned size() const;
+ unsigned size() const;
+ bool empty() const { return path.empty(); }
bool is_absolute() const;
Path subpath(unsigned, unsigned =(unsigned)-1) const;
Path operator/(const Path &p) const { Path a=*this; a/=p; return a; }