Commit d3d99ffe authored by Pavel Vainerman's avatar Pavel Vainerman

Применил где можно emplace_back вместо push_back. (c++11).

parent 4956d41e
...@@ -199,8 +199,7 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID ) ...@@ -199,8 +199,7 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
delete[] argv; delete[] argv;
RRDInfo rrd(fname,tmID,rrdstep,dsmap); rrdlist.emplace_back(fname,tmID,rrdstep,dsmap);
rrdlist.push_back(rrd);
} }
/* catch( Exception& ex ) /* catch( Exception& ex )
{ {
......
...@@ -328,7 +328,7 @@ void Calibration::setCacheSize( unsigned int sz ) ...@@ -328,7 +328,7 @@ void Calibration::setCacheSize( unsigned int sz )
void Calibration::insertToCache( const long raw, const long val ) void Calibration::insertToCache( const long raw, const long val )
{ {
cache.pop_back(); // удаляем последний элемент (как самый неиспользуемый) cache.pop_back(); // удаляем последний элемент (как самый неиспользуемый)
cache.push_back( CacheInfo(raw,val) ); // добавляем в конец.. cache.emplace_back(raw,val); // добавляем в конец..
sort(cache.begin(),cache.end()); // пересортируем в порядке уменьшения обращений (см. CacheInfo::operator< ) sort(cache.begin(),cache.end()); // пересортируем в порядке уменьшения обращений (см. CacheInfo::operator< )
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
......
...@@ -280,7 +280,7 @@ DataMap read_confile( const std::string& f ) ...@@ -280,7 +280,7 @@ DataMap read_confile( const std::string& f )
tmp = "0x" + tmp; tmp = "0x" + tmp;
// cout << "find data=" << ModbusRTU::str2mbData(tmp) // cout << "find data=" << ModbusRTU::str2mbData(tmp)
// << "(" << tmp << ")" << endl; // << "(" << tmp << ")" << endl;
dlst.push_back( ModbusRTU::str2mbData(tmp) ); dlst.emplace_back( ModbusRTU::str2mbData(tmp) );
} }
} }
......
...@@ -430,8 +430,8 @@ bool NCRestorer_XML::getConsumerList( const UniXML& xml, xmlNode* node, ...@@ -430,8 +430,8 @@ bool NCRestorer_XML::getConsumerList( const UniXML& xml, xmlNode* node,
if( !getConsumerInfo(it,ci.id,ci.node) ) if( !getConsumerInfo(it,ci.id,ci.node) )
continue; continue;
IONotifyController::ConsumerInfoExt cinf(ci); // IONotifyController::ConsumerInfoExt cinf(ci);
lst.clst.push_back(cinf); lst.clst.emplace_back(ci);
cslot(xml,it,node); cslot(xml,it,node);
} }
......
...@@ -152,7 +152,7 @@ timeout_t LT_Object::askTimer( UniSetTypes::TimerId timerid, timeout_t timeMS, c ...@@ -152,7 +152,7 @@ timeout_t LT_Object::askTimer( UniSetTypes::TimerId timerid, timeout_t timeMS, c
} }
// TimerInfo newti(timerid, timeMS, ticks, p); // TimerInfo newti(timerid, timeMS, ticks, p);
tlst.push_back( std::move(TimerInfo(timerid, timeMS, ticks, p)) ); tlst.emplace_back(timerid, timeMS, ticks, p);
} // unlock } // unlock
uinfo << "(LT_askTimer): поступил заказ на таймер(id="<< timerid << ") " << timeMS << " [мс]\n"; uinfo << "(LT_askTimer): поступил заказ на таймер(id="<< timerid << ") " << timeMS << " [мс]\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment