Skip to content

Commit 8bc5554

Browse files
authored
Rename FlatMap::assign to FlatMap::emplace (#1779)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent ca9a408 commit 8bc5554

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/core/json/include/sourcemeta/core/json_object.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ template <typename Key, typename Value, typename Hash> class FlatMap {
4242
FlatMap(std::initializer_list<value_type> entries) {
4343
this->data.reserve(entries.size());
4444
for (auto &&entry : entries) {
45-
this->assign(std::move(entry.first), std::move(entry.second));
45+
this->emplace(std::move(entry.first), std::move(entry.second));
4646
}
4747
}
4848

@@ -55,7 +55,7 @@ template <typename Key, typename Value, typename Hash> class FlatMap {
5555
return this->hasher(key);
5656
}
5757

58-
auto assign(key_type &&key, mapped_type &&value) -> hash_type {
58+
auto emplace(key_type &&key, mapped_type &&value) -> hash_type {
5959
const auto key_hash{this->hash(key)};
6060

6161
if (this->hasher.is_perfect(key_hash)) {
@@ -78,7 +78,7 @@ template <typename Key, typename Value, typename Hash> class FlatMap {
7878
return key_hash;
7979
}
8080

81-
auto assign(const key_type &key, const mapped_type &value) -> hash_type {
81+
auto emplace(const key_type &key, const mapped_type &value) -> hash_type {
8282
const auto key_hash{this->hash(key)};
8383

8484
if (this->hasher.is_perfect(key_hash)) {

src/core/json/json_value.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,12 +801,12 @@ auto JSON::push_back_if_unique(JSON &&value)
801801

802802
auto JSON::assign(const JSON::String &key, const JSON &value) -> void {
803803
assert(this->is_object());
804-
this->data_object.data.assign(key, value);
804+
this->data_object.data.emplace(key, value);
805805
}
806806

807807
auto JSON::assign(const JSON::String &key, JSON &&value) -> void {
808808
assert(this->is_object());
809-
this->data_object.data.assign(key, std::move(value));
809+
this->data_object.data.emplace(key, std::move(value));
810810
}
811811

812812
auto JSON::assign_if_missing(const JSON::String &key, const JSON &value)

0 commit comments

Comments
 (0)