diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-04-28 16:13:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-04-28 16:13:54 +0200 |
commit | 56ce5687567150b0b2cc3e57540d564793ef6bf7 (patch) | |
tree | 79b3cef1169b82f8d85459b285e2fc39f9d8a0e9 /build/path.ixx | |
parent | 9d818423031083f227a5e872826ed8c2d6e14a0f (diff) |
Add support for iteration over path components
Diffstat (limited to 'build/path.ixx')
-rw-r--r-- | build/path.ixx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/build/path.ixx b/build/path.ixx index ff1ec32..8ee6a33 100644 --- a/build/path.ixx +++ b/build/path.ixx @@ -85,6 +85,41 @@ namespace build } template <typename C, typename K> + inline auto basic_path<C, K>:: + begin () const -> iterator + { + size_type b, e; + + if (this->path_.empty ()) + b = e = string_type::npos; + +#ifndef _WIN32 + else if (root ()) + { + // We want to return a single empty component. Here we return + // the begin position one past the end. Not sure if this legal. + // + b = 1; + e = string_type::npos; + } +#endif + else + { + b = 0; + e = traits::find_separator (this->path_); + } + + return iterator (this->path_, b, e); + } + + template <typename C, typename K> + inline auto basic_path<C, K>:: + end () const -> iterator + { + return iterator (this->path_, string_type::npos, string_type::npos); + } + + template <typename C, typename K> inline basic_path<C, K>& basic_path<C, K>:: complete () { |