Rebase fill-extrusion work to eliminate dependence on render target branch (#1618)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Alex Cristici <alex.cristici@gmail.com> Co-authored-by: mwilsnd <mwilsnd@gmail.com> Co-authored-by: Stefan Karschti <stefan.karschti@gmail.com> Co-authored-by: Bart Louwers <bart@emeel.net> Co-authored-by: Alex Cristici <alex@skoon.energy> Co-authored-by: Bart Louwers <bart.louwers@gmail.com> Co-authored-by: Wei Chen <alanchenboy@gmail.com> Co-authored-by: Siarhei Fedartsou <siarhei.fedartsou@gmail.com> Co-authored-by: tdcosta100 <tdcosta100@gmail.com>
This commit is contained in:
@@ -6,8 +6,25 @@ namespace mbgl {
|
||||
|
||||
namespace {
|
||||
const std::string empty;
|
||||
constexpr std::size_t initialCapacity = 100;
|
||||
} // namespace
|
||||
|
||||
StringIndexer::StringIndexer()
|
||||
: stringToIdentity(initialCapacity) {
|
||||
identityToString.reserve(initialCapacity);
|
||||
}
|
||||
|
||||
// For now, we have to make a copy to search the string-keyed container.
|
||||
StringIdentity StringIndexer::get(const char* string) {
|
||||
return get(std::string(string));
|
||||
}
|
||||
// Once we can search using a string_view this should be the primary version.
|
||||
StringIdentity StringIndexer::get(std::string_view string) {
|
||||
return get(std::string(string));
|
||||
}
|
||||
|
||||
// We take a const reference rather than an lvalue (copy) under the assumption that most calls will
|
||||
// find a match and insertions where we could move are rare.
|
||||
StringIdentity StringIndexer::get(const std::string& string) {
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> readerLock(instance().sharedMutex);
|
||||
|
||||
Reference in New Issue
Block a user