aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-05-25 16:13:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-05-25 16:13:22 +0200
commitf6c981e551f174809499163fc45c6fa54b8c5914 (patch)
treea17451657800c31634d68814b3959a3ece071123
parentcd4e709ead8a3e97eee0ef7b362240986e18fbd5 (diff)
Store pointer to map key rather than iterator
Clang's libc++ complains about a map iterator instantiation that has an incomplete value. At the same time, it appears that references (and thus pointers) to map elements are also stable.
-rw-r--r--build/scope8
-rw-r--r--build/scope.cxx2
2 files changed, 4 insertions, 6 deletions
diff --git a/build/scope b/build/scope
index 6051534..7dec7a2 100644
--- a/build/scope
+++ b/build/scope
@@ -21,7 +21,7 @@ namespace build
{
public:
const dir_path&
- path () const {return i_->first;} // Absolute and normalized.
+ path () const {return *path_;} // Absolute and normalized.
const dir_path&
src_path () const {return *src_path_;} // Corresponding src path.
@@ -112,11 +112,9 @@ namespace build
friend class scope_map;
friend class temp_scope;
- typedef dir_path_map<scope>::const_iterator iterator;
-
scope () = default;
- iterator i_;
+ const dir_path* path_; // Pointer to the key in scope_map.
scope* parent_;
scope* root_;
};
@@ -132,7 +130,7 @@ namespace build
class temp_scope: public scope
{
public:
- temp_scope (scope& p) {i_ = p.i_; parent_ = &p; root_ = p.root_;}
+ temp_scope (scope& p) {path_ = p.path_; parent_ = &p; root_ = p.root_;}
};
class scope_map: public dir_path_map<scope>
diff --git a/build/scope.cxx b/build/scope.cxx
index 0495011..2b24702 100644
--- a/build/scope.cxx
+++ b/build/scope.cxx
@@ -88,7 +88,7 @@ namespace build
p = &find (k.directory ());
}
- s.i_ = er.first;
+ s.path_ = &er.first->first;
s.parent_ = p;
s.root_ = root ? &s : (p != nullptr ? p->root_ : nullptr);
}