From eb9e5fb7275e5099b0392dc4bba8ce4dece6b11d Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 29 May 2024 21:42:46 -0400 Subject: [PATCH] Eliminate various unnecessary uses of `std::make_pair`. --- OSBindings/SDL/main.cpp | 4 ++-- Processors/65816/Implementation/65816Storage.cpp | 2 +- Reflection/Enum.hpp | 4 ++-- Reflection/Struct.hpp | 2 +- Storage/Disk/DiskImage/DiskImageImplementation.hpp | 2 +- Storage/Disk/Encodings/AppleGCR/SegmentParser.cpp | 4 ++-- Storage/Disk/Encodings/MFM/SegmentParser.cpp | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/OSBindings/SDL/main.cpp b/OSBindings/SDL/main.cpp index 7d2cfa29f..60620adb3 100644 --- a/OSBindings/SDL/main.cpp +++ b/OSBindings/SDL/main.cpp @@ -246,7 +246,7 @@ class ActivityObserver: public Activity::Observer { const float right_x = 1.0f - 2.0f * width; float y = 1.0f - 2.0f * height; for(const auto &drive: drives_) { - lights_.emplace(std::make_pair(drive, std::make_unique(right_x, y, width, height))); + lights_.emplace(drive, std::make_unique(right_x, y, width, height)); y -= height * 2.0f; } @@ -257,7 +257,7 @@ class ActivityObserver: public Activity::Observer { const float left_x = -1.0f + 2.0f * width; y = 1.0f - 2.0f * height; for(const auto &led: leds_) { - lights_.emplace(std::make_pair(led, std::make_unique(left_x, y, width, height))); + lights_.emplace(led, std::make_unique(left_x, y, width, height)); y -= height * 2.0f; } */ diff --git a/Processors/65816/Implementation/65816Storage.cpp b/Processors/65816/Implementation/65816Storage.cpp index a53468ee3..fd89b8551 100644 --- a/Processors/65816/Implementation/65816Storage.cpp +++ b/Processors/65816/Implementation/65816Storage.cpp @@ -153,7 +153,7 @@ struct CPU::WDC65816::ProcessorStorageConstructor { } // Insert into the map and return the resulting iterator. - return installed_patterns.insert(std::make_pair(key, std::make_pair(micro_op_location_8, micro_op_location_16))).first; + return installed_patterns.insert({key, {micro_op_location_8, micro_op_location_16}}).first; } public: diff --git a/Reflection/Enum.hpp b/Reflection/Enum.hpp index 919daa80b..c2233567a 100644 --- a/Reflection/Enum.hpp +++ b/Reflection/Enum.hpp @@ -72,8 +72,8 @@ class Enum { result.emplace_back(std::string(start, size_t(d_ptr - start))); } - members_by_type_.emplace(std::make_pair(std::type_index(typeid(Type)), result)); - names_by_type_.emplace(std::make_pair(std::type_index(typeid(Type)), std::string(name))); + members_by_type_.emplace(std::type_index(typeid(Type)), result); + names_by_type_.emplace(std::type_index(typeid(Type)), std::string(name)); } /*! diff --git a/Reflection/Struct.hpp b/Reflection/Struct.hpp index 2ead24eb9..dc6223bf1 100644 --- a/Reflection/Struct.hpp +++ b/Reflection/Struct.hpp @@ -294,7 +294,7 @@ template class StructImpl: public Struct { } va_end(list); - permitted_enum_values_.emplace(std::make_pair(name, permitted_values)); + permitted_enum_values_.emplace(name, permitted_values); } /*! diff --git a/Storage/Disk/DiskImage/DiskImageImplementation.hpp b/Storage/Disk/DiskImage/DiskImageImplementation.hpp index c5b3ddd61..73a6034e0 100644 --- a/Storage/Disk/DiskImage/DiskImageImplementation.hpp +++ b/Storage/Disk/DiskImage/DiskImageImplementation.hpp @@ -25,7 +25,7 @@ template void DiskImageHolder::flush_tracks() { using TrackMap = std::map>; std::shared_ptr track_copies(new TrackMap); for(const auto &address : unwritten_tracks_) { - track_copies->insert(std::make_pair(address, std::shared_ptr(cached_tracks_[address]->clone()))); + track_copies->insert({address, std::shared_ptr(cached_tracks_[address]->clone())}); } unwritten_tracks_.clear(); diff --git a/Storage/Disk/Encodings/AppleGCR/SegmentParser.cpp b/Storage/Disk/Encodings/AppleGCR/SegmentParser.cpp index 7e0802551..8f22eb5b6 100644 --- a/Storage/Disk/Encodings/AppleGCR/SegmentParser.cpp +++ b/Storage/Disk/Encodings/AppleGCR/SegmentParser.cpp @@ -317,14 +317,14 @@ std::map Storage::Encodings::AppleGCR::sectors_from_segment // Potentially this is a Macintosh sector. auto macintosh_sector = decode_macintosh_sector(had_header ? &header : nullptr, sector); if(macintosh_sector) { - result.insert(std::make_pair(sector_location, std::move(*macintosh_sector))); + result.insert({sector_location, std::move(*macintosh_sector)}); continue; } // Apple II then? auto appleii_sector = decode_appleii_sector(had_header ? &header : nullptr, sector, is_five_and_three); if(appleii_sector) { - result.insert(std::make_pair(sector_location, std::move(*appleii_sector))); + result.insert({sector_location, std::move(*appleii_sector)}); } } else { new_sector->data.push_back(value); diff --git a/Storage/Disk/Encodings/MFM/SegmentParser.cpp b/Storage/Disk/Encodings/MFM/SegmentParser.cpp index 86a69f0e2..95147385e 100644 --- a/Storage/Disk/Encodings/MFM/SegmentParser.cpp +++ b/Storage/Disk/Encodings/MFM/SegmentParser.cpp @@ -72,7 +72,7 @@ std::map Storage::Encodings::MFM:: new_sector->samples[0].push_back(shifter.get_byte()); ++position; if(position == size + 4) { - result.insert(std::make_pair(start_location, std::move(*new_sector))); + result.insert({start_location, std::move(*new_sector)}); is_reading = false; shifter.set_should_obey_syncs(true); new_sector.reset();