remove std::make_pair
make_pair is an old C++98 function that can be replaced by modern shorter constructs. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
15f419e1cb
commit
6ec5089cc9
|
@ -98,8 +98,7 @@ initPermissions(const ConfigData &config)
|
|||
std::string password(value, separator);
|
||||
|
||||
unsigned permission = parsePermissions(separator + 1);
|
||||
permission_passwords.insert(std::make_pair(std::move(password),
|
||||
permission));
|
||||
permission_passwords.emplace(std::move(password), permission);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ static void
|
|||
CollectGroupCounts(TagCountMap &map, const Tag &tag,
|
||||
const char *value) noexcept
|
||||
{
|
||||
auto &s = map.insert(std::make_pair(value, SearchStats())).first->second;
|
||||
auto &s = map.emplace(value, SearchStats()).first->second;
|
||||
++s.n_songs;
|
||||
if (!tag.duration.IsNegative())
|
||||
s.total_duration += tag.duration;
|
||||
|
|
|
@ -109,8 +109,7 @@ static std::map<int, WatchDirectory *> inotify_directories;
|
|||
static void
|
||||
tree_add_watch_directory(WatchDirectory *directory)
|
||||
{
|
||||
inotify_directories.insert(std::make_pair(directory->descriptor,
|
||||
directory));
|
||||
inotify_directories.emplace(directory->descriptor, directory);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -317,7 +317,7 @@ faad_get_file_time(InputStream &is)
|
|||
}
|
||||
}
|
||||
|
||||
return std::make_pair(recognized, duration);
|
||||
return {recognized, duration};
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -160,7 +160,7 @@ FindHybridDsdData(DecoderClient &client, InputStream &input)
|
|||
if (!found_version || !audio_format.IsValid())
|
||||
throw UnsupportedFile();
|
||||
|
||||
return std::make_pair(audio_format, remaining);
|
||||
return {audio_format, remaining};
|
||||
}
|
||||
|
||||
/* skip this chunk payload */
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
auto last = cdio_cddap_disc_lastsector(drv);
|
||||
if (first < 0 || last < 0)
|
||||
throw std::runtime_error("Failed to get disc audio sectors");
|
||||
return std::make_pair(first, last);
|
||||
return std::pair(first, last);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
|
@ -98,7 +98,7 @@ public:
|
|||
auto last = cdio_cddap_track_lastsector(drv, i);
|
||||
if (first < 0 || last < 0)
|
||||
throw std::runtime_error("Invalid track number");
|
||||
return std::make_pair(first, last);
|
||||
return std::pair(first, last);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
|
|
|
@ -152,7 +152,7 @@ public:
|
|||
if (err < 0)
|
||||
throw MakeFfmpegError(err, "avfilter_graph_parse_ptr() failed");
|
||||
|
||||
return std::make_pair(std::move(inputs), std::move(outputs));
|
||||
return {std::move(inputs), std::move(outputs)};
|
||||
}
|
||||
|
||||
void ParseSingleInOut(const char *filters, AVFilterContext &in,
|
||||
|
@ -165,7 +165,7 @@ public:
|
|||
if (err < 0)
|
||||
throw MakeFfmpegError(err, "avfilter_graph_parse2() failed");
|
||||
|
||||
return std::make_pair(FilterInOut{inputs}, FilterInOut{outputs});
|
||||
return {FilterInOut{inputs}, FilterInOut{outputs}};
|
||||
}
|
||||
|
||||
void CheckAndConfigure() {
|
||||
|
|
|
@ -450,10 +450,9 @@ AlsaOutput::GetAttributes() const noexcept
|
|||
const std::lock_guard<Mutex> lock(attributes_mutex);
|
||||
|
||||
return {
|
||||
std::make_pair("allowed_formats",
|
||||
Alsa::ToString(allowed_formats)),
|
||||
{"allowed_formats", Alsa::ToString(allowed_formats)},
|
||||
#ifdef ENABLE_DSD
|
||||
std::make_pair("dop", dop_setting ? "1" : "0"),
|
||||
{"dop", dop_setting ? "1" : "0"},
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ StickerDatabase::ListValues(std::map<std::string, std::string> &table,
|
|||
ExecuteForEach(s, [s, &table](){
|
||||
const char *name = (const char *)sqlite3_column_text(s, 0);
|
||||
const char *value = (const char *)sqlite3_column_text(s, 1);
|
||||
table.insert(std::make_pair(name, value));
|
||||
table.emplace(name, value);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ ParseTimeZoneOffsetRaw(const char *&s)
|
|||
unsigned long value = std::strtoul(s, &endptr, 10);
|
||||
if (endptr == s + 4) {
|
||||
s = endptr;
|
||||
return std::make_pair(value / 100, value % 100);
|
||||
return {value / 100, value % 100};
|
||||
} else if (endptr == s + 2) {
|
||||
s = endptr;
|
||||
|
||||
|
@ -82,7 +82,7 @@ ParseTimeZoneOffsetRaw(const char *&s)
|
|||
s = endptr;
|
||||
}
|
||||
|
||||
return std::make_pair(hours, minutes);
|
||||
return {hours, minutes};
|
||||
} else
|
||||
throw std::invalid_argument("Failed to parse time zone offset");
|
||||
}
|
||||
|
@ -234,6 +234,6 @@ ParseISO8601(const char *s)
|
|||
if (*s != 0)
|
||||
throw std::invalid_argument("Garbage at end of time stamp");
|
||||
|
||||
return std::make_pair(tp, precision);
|
||||
return {tp, precision};
|
||||
#endif /* !_WIN32 */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue