- if(start>=path.path.size())
- return string();
- if(start==end)
- return string();
- return path.path.substr(start, end-start);
+ if(end)
+ throw logic_error("Path::Iterator::operator*");
+
+ string::size_type start = 0;
+ if(iter!=path->separators.begin())
+ {
+ PositionArray::const_iterator prev = iter;
+ start = *--prev+1;
+ }
+
+ string::size_type slash = string::npos;
+ if(iter!=path->separators.end())
+ slash = *iter;
+
+ if(slash==0)
+ return path->path.substr(start, 1);
+ return path->path.substr(start, slash-start);