diff --git a/src/blackcore/application.cpp b/src/blackcore/application.cpp index 8dbc8ea08..b40572a3d 100644 --- a/src/blackcore/application.cpp +++ b/src/blackcore/application.cpp @@ -190,7 +190,7 @@ namespace BlackCore //! \fixme KB 2017-11 maybe this code can be encapsulated somewhere CApplicationInfoList apps = CApplication::getRunningApplications(); const CApplicationInfo myself = CApplication::instance()->getApplicationInfo(); - if (!apps.contains(myself)) { apps.insert(myself); } + if (!apps.contains(myself)) { apps.push_back(myself); } const bool ok = CFileUtils::writeStringToLockedFile(apps.toJsonString(), CFileUtils::appendFilePaths(swiftDataRoot(), "apps.json")); if (!ok) { CLogMessage(static_cast(nullptr)).error("Failed to write to application list file"); } return ok; diff --git a/src/blackmisc/sequence.h b/src/blackmisc/sequence.h index aa3d95bed..4338ad632 100644 --- a/src/blackmisc/sequence.h +++ b/src/blackmisc/sequence.h @@ -181,6 +181,9 @@ namespace BlackMisc //! Insert as first element. void push_front(const T &value) { insert(begin(), value); } + //! Inserts all elements from another sequence at the beginning of this sequence. + void push_front(const CSequence &other) { std::copy(other.begin(), other.end(), std::front_inserter(*this)); } + //! Insert as first element by keep maxElements void push_frontMaxElements(const T &value, int maxElements) { diff --git a/src/blackmisc/simulation/aircraftmodellist.cpp b/src/blackmisc/simulation/aircraftmodellist.cpp index fd272059b..7a0255ddf 100644 --- a/src/blackmisc/simulation/aircraftmodellist.cpp +++ b/src/blackmisc/simulation/aircraftmodellist.cpp @@ -768,7 +768,7 @@ namespace BlackMisc for (const CAircraftModel &model : *this) { if (model.getAirlineIcaoCode() != airlineCode) { continue; } - icaos.insert(model.getAircraftIcaoCode()); + icaos.push_back(model.getAircraftIcaoCode()); } return icaos; } @@ -1030,7 +1030,7 @@ namespace BlackMisc Q_UNUSED(scope); CAircraftModel value; value.convertFromMemoizedJson(i->toObject(), helper); - insert(value); + this->push_back(value); } } diff --git a/src/plugins/weatherdata/gfs/weatherdatagfs.cpp b/src/plugins/weatherdata/gfs/weatherdatagfs.cpp index 660f9c719..893da1ff8 100644 --- a/src/plugins/weatherdata/gfs/weatherdatagfs.cpp +++ b/src/plugins/weatherdata/gfs/weatherdatagfs.cpp @@ -270,7 +270,7 @@ namespace BlackWxPlugin CAltitude surfaceAltitude(0, CAltitude::AboveGround, CLengthUnit::defaultUnit()); CTemperatureLayer surfaceTemperature(surfaceAltitude, CTemperature(gfsGridPoint.surfaceTemperature, CTemperatureUnit::K()), {}, {}); - temperatureLayers.insert(surfaceTemperature); + temperatureLayers.push_back(surfaceTemperature); CWindLayerList windLayers; for (auto isobaricLayerIt = gfsGridPoint.isobaricLayers.begin(); isobaricLayerIt != gfsGridPoint.isobaricLayers.end(); ++isobaricLayerIt) @@ -282,7 +282,7 @@ namespace BlackWxPlugin auto dewPoint = calculateDewPoint(temperature, isobaricLayer.relativeHumidity); CTemperatureLayer temperatureLayer(level, temperature, dewPoint, isobaricLayer.relativeHumidity); - temperatureLayers.insert(temperatureLayer); + temperatureLayers.push_back(temperatureLayer); double windDirection = -1 * CMathUtils::rad2deg(std::atan2(-isobaricLayer.windU, isobaricLayer.windV)); windDirection += 180.0; @@ -290,7 +290,7 @@ namespace BlackWxPlugin if (windDirection >= 360.0) { windDirection -= 360.0; } double windSpeed = std::hypot(isobaricLayer.windU, isobaricLayer.windV); CWindLayer windLayer(level, CAngle(windDirection, CAngleUnit::deg()), CSpeed(windSpeed, CSpeedUnit::m_s()), {}); - windLayers.insert(windLayer); + windLayers.push_back(windLayer); } CCloudLayerList cloudLayers; @@ -307,7 +307,7 @@ namespace BlackWxPlugin // Multiply with 3600 to convert to mm/h cloudLayer.setPrecipitationRate(gfsGridPoint.surfacePrecipitationRate * 3600.0); cloudLayer.setClouds(CCloudLayer::CloudsUnknown); - cloudLayers.insert(cloudLayer); + cloudLayers.push_back(cloudLayer); } auto surfacePressure = PhysicalQuantities::CPressure { gfsGridPoint.surfacePressure, PhysicalQuantities::CPressureUnit::Pa() }; @@ -315,8 +315,8 @@ namespace BlackWxPlugin CLatitude latitude(gfsGridPoint.latitude, CAngleUnit::deg()); CLongitude longitude(gfsGridPoint.longitude, CAngleUnit::deg()); auto position = CCoordinateGeodetic { latitude, longitude, {0} }; - BlackMisc::Weather::CGridPoint gridPoint({}, position, cloudLayers, temperatureLayers, {}, windLayers, surfacePressure); - m_weatherGrid.insert(gridPoint); + CGridPoint gridPoint({}, position, cloudLayers, temperatureLayers, {}, windLayers, surfacePressure); + m_weatherGrid.push_back(gridPoint); } }