diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-07-10 03:11:59 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-07-10 03:11:59 -0400 |
commit | ca3eacbd790a7e50a7fe5070e975c10255a1e174 (patch) | |
tree | d1d2c0d01e42544f68ac37b1052a0ac84ec3383e /discord/discord.cpp | |
parent | fa87adb4a3acdd04b6740a97f06ba463f3408231 (diff) | |
download | abaddon-portaudio-ca3eacbd790a7e50a7fe5070e975c10255a1e174.tar.gz abaddon-portaudio-ca3eacbd790a7e50a7fe5070e975c10255a1e174.zip |
dont use unordered collections (reduce memory a bit)
Diffstat (limited to 'discord/discord.cpp')
-rw-r--r-- | discord/discord.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/discord/discord.cpp b/discord/discord.cpp index cdee337..ffab9b6 100644 --- a/discord/discord.cpp +++ b/discord/discord.cpp @@ -234,19 +234,19 @@ std::optional<RoleData> DiscordClient::GetMemberHighestRole(Snowflake guild_id, }); } -std::unordered_set<Snowflake> DiscordClient::GetUsersInGuild(Snowflake id) const { +std::set<Snowflake> DiscordClient::GetUsersInGuild(Snowflake id) const { auto it = m_guild_to_users.find(id); if (it != m_guild_to_users.end()) return it->second; - return std::unordered_set<Snowflake>(); + return {}; } -std::unordered_set<Snowflake> DiscordClient::GetChannelsInGuild(Snowflake id) const { +std::set<Snowflake> DiscordClient::GetChannelsInGuild(Snowflake id) const { auto it = m_guild_to_channels.find(id); if (it != m_guild_to_channels.end()) return it->second; - return std::unordered_set<Snowflake>(); + return {}; } bool DiscordClient::HasGuildPermission(Snowflake user_id, Snowflake guild_id, Permission perm) const { @@ -954,12 +954,12 @@ PresenceStatus DiscordClient::GetUserStatus(Snowflake id) const { return PresenceStatus::Offline; } -std::unordered_map<Snowflake, RelationshipType> DiscordClient::GetRelationships() const { +std::map<Snowflake, RelationshipType> DiscordClient::GetRelationships() const { return m_user_relationships; } -std::unordered_set<Snowflake> DiscordClient::GetRelationships(RelationshipType type) const { - std::unordered_set<Snowflake> ret; +std::set<Snowflake> DiscordClient::GetRelationships(RelationshipType type) const { + std::set<Snowflake> ret; for (const auto &[id, rtype] : m_user_relationships) if (rtype == type) ret.insert(id); |