diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-11 11:36:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-11 13:51:29 +0200 |
commit | db17a874af37350b3270932175854ee674447bc1 (patch) | |
tree | fecc983fb75d3a4072cc7bd344fc824d548deb0d /cppuhelper | |
parent | dd8a400bbbb1b8d5592a870f2036a4df3d005a7d (diff) |
convert std::map::insert to std::map::emplace II
Change-Id: Ief8bd59c903625ba65b75114b7b52c3b7ecbd331
Reviewed-on: https://gerrit.libreoffice.org/41019
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/component_context.cxx | 4 | ||||
-rw-r--r-- | cppuhelper/source/propertysetmixin.cxx | 5 | ||||
-rw-r--r-- | cppuhelper/source/servicemanager.cxx | 14 | ||||
-rw-r--r-- | cppuhelper/source/unourl.cxx | 5 |
4 files changed, 10 insertions, 18 deletions
diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx index 952ee693659c..8555feaef4c9 100644 --- a/cppuhelper/source/component_context.cxx +++ b/cppuhelper/source/component_context.cxx @@ -185,8 +185,8 @@ void ComponentContext::insertByName( name.startsWith( "/singletons/" ) && !element.hasValue() ) ); MutexGuard guard( m_mutex ); - std::pair<t_map::iterator, bool> insertion( m_map.insert( - t_map::value_type( name, entry ) ) ); + std::pair<t_map::iterator, bool> insertion( m_map.emplace( + name, entry ) ); if (! insertion.second) throw container::ElementExistException( "element already exists: " + name, diff --git a/cppuhelper/source/propertysetmixin.cxx b/cppuhelper/source/propertysetmixin.cxx index 111da6478601..32ede83068c0 100644 --- a/cppuhelper/source/propertysetmixin.cxx +++ b/cppuhelper/source/propertysetmixin.cxx @@ -242,8 +242,7 @@ void Data::initProperties( "interface type has too many attributes"); } rtl::OUString name(members[i]->getMemberName()); - if (!properties.insert( - PropertyMap::value_type( + if (!properties.emplace( name, PropertyData( css::beans::Property( @@ -252,7 +251,7 @@ void Data::initProperties( t->getTypeClass(), t->getName()), attrAttribs), (std::find(absentBegin, absentEnd, name) - == absentEnd)))). + == absentEnd))). second) { throw css::uno::RuntimeException( diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 5faee9a129b0..c77526de6441 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -384,9 +384,7 @@ void Parser::handleImplementation() { new cppuhelper::ServiceManager::Data::Implementation( attrName, attrLoader_, attrUri_, attrEnvironment_, attrConstructor, attrPrefix_, alienContext_, reader_.getUrl())); - if (!data_->namedImplementations.insert( - cppuhelper::ServiceManager::Data::NamedImplementations::value_type( - attrName, implementation_)). + if (!data_->namedImplementations.emplace(attrName, implementation_). second) { throw css::registry::InvalidRegistryException( @@ -1445,9 +1443,7 @@ bool cppuhelper::ServiceManager::readLegacyRdbFile(rtl::OUString const & uri) { name, readLegacyRdbString(uri, implKey, "UNO/ACTIVATOR"), readLegacyRdbString(uri, implKey, "UNO/LOCATION"), "", "", "", css::uno::Reference< css::uno::XComponentContext >(), uri)); - if (!data_.namedImplementations.insert( - Data::NamedImplementations::value_type(name, impl)). - second) + if (!data_.namedImplementations.emplace(name, impl).second) { throw css::registry::InvalidRegistryException( uri + ": duplicate <implementation name=\"" + name + "\">"); @@ -1580,11 +1576,9 @@ void cppuhelper::ServiceManager::insertLegacyFactory( new Data::Implementation(name, f1, f2, comp)); Data extra; if (!name.isEmpty()) { - extra.namedImplementations.insert( - Data::NamedImplementations::value_type(name, impl)); + extra.namedImplementations.emplace(name, impl); } - extra.dynamicImplementations.insert( - Data::DynamicImplementations::value_type(factoryInfo, impl)); + extra.dynamicImplementations.emplace(factoryInfo, impl); css::uno::Sequence< rtl::OUString > services( factoryInfo->getSupportedServiceNames()); for (sal_Int32 i = 0; i != services.getLength(); ++i) { diff --git a/cppuhelper/source/unourl.cxx b/cppuhelper/source/unourl.cxx index ce1249d4818a..cfd62ef23e6f 100644 --- a/cppuhelper/source/unourl.cxx +++ b/cppuhelper/source/unourl.cxx @@ -118,13 +118,12 @@ inline UnoUrlDescriptor::Impl::Impl(rtl::OUString const & rDescriptor) case STATE_VALUE: if (bEnd || c == 0x2C) // ',' { - if (!m_aParameters.insert( - Parameters::value_type( + if (!m_aParameters.emplace( aKey, rtl::Uri::decode(rDescriptor.copy(nStart, i - nStart), rtl_UriDecodeWithCharset, - RTL_TEXTENCODING_UTF8))).second) + RTL_TEXTENCODING_UTF8)).second) throw rtl::MalformedUriException( "UNO URL contains duplicated parameter"); eState = STATE_KEY0; |