From f6c981e551f174809499163fc45c6fa54b8c5914 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 25 May 2015 16:13:22 +0200 Subject: 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. --- build/scope | 8 +++----- build/scope.cxx | 2 +- 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::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 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); } -- cgit v1.1