base: Make AddrRangeMap able to return non-const iterators.
authorGabe Black <gabeblack@google.com>
Fri, 22 Mar 2019 00:07:58 +0000 (17:07 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 26 Mar 2019 18:11:06 +0000 (18:11 +0000)
commitfcc4c4fed945d0575d40fe314573a2081d66b2ee
tree9dc92db64b915c50d969a8db865e7e03c2ef92ce
parentc67d89f38287fa90631e41cf1cd85e422e8661ac
base: Make AddrRangeMap able to return non-const iterators.

The erase() method only accepts regular iterators which is consistent
with the normal STL map, but the existing find() only returns const
iterators. The STL container can return either depending on if "this"
is const.

Unfortunately there isn't a great way to have only one find
implementation which returns the right type of iterator under the right
conditions. Also, it's not possible to turn a const_iterator into an
iterator, but it is possible to go the other way. This change
duplicates very short functions which return iterators, and for find
does the only thing I could find which avoids having to copy that
whole large function.

Change-Id: I2f789b5d0881feb9adff9978bd40e31731c6a688
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17588
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
src/base/addr_range_map.hh