Skip to content

Commit 90d4aa7

Browse files
authored
Fix StringSet::value_type type trait (#455)
Fixes: #454 Signed-off-by: Juan Cruz Viotti <[email protected]>
1 parent a5d72bc commit 90d4aa7

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/evaluator/evaluator_string_set.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace sourcemeta::blaze {
66

7-
auto StringSet::contains(const value_type &value, const hash_type hash) const
7+
auto StringSet::contains(const string_type &value, const hash_type hash) const
88
-> bool {
99
if (this->hasher.is_perfect(hash)) {
1010
for (const auto &entry : this->data) {
@@ -23,7 +23,7 @@ auto StringSet::contains(const value_type &value, const hash_type hash) const
2323
return false;
2424
}
2525

26-
auto StringSet::insert(const value_type &value) -> void {
26+
auto StringSet::insert(const string_type &value) -> void {
2727
const auto hash{this->hasher(value)};
2828
if (!this->contains(value, hash)) {
2929
this->data.emplace_back(value, hash);
@@ -34,7 +34,7 @@ auto StringSet::insert(const value_type &value) -> void {
3434
}
3535
}
3636

37-
auto StringSet::insert(value_type &&value) -> void {
37+
auto StringSet::insert(string_type &&value) -> void {
3838
const auto hash{this->hasher(value)};
3939
if (!this->contains(value, hash)) {
4040
this->data.emplace_back(std::move(value), hash);

src/evaluator/include/sourcemeta/blaze/evaluator_string_set.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@ class SOURCEMETA_BLAZE_EVALUATOR_EXPORT StringSet {
1717
public:
1818
StringSet() = default;
1919

20-
using value_type = sourcemeta::core::JSON::String;
20+
using string_type = sourcemeta::core::JSON::String;
2121
using hash_type = sourcemeta::core::JSON::Object::Container::hash_type;
22-
using underlying_type = std::vector<std::pair<value_type, hash_type>>;
22+
using value_type = std::pair<string_type, hash_type>;
23+
using underlying_type = std::vector<value_type>;
2324
using size_type = typename underlying_type::size_type;
2425
using difference_type = typename underlying_type::difference_type;
2526
using const_iterator = typename underlying_type::const_iterator;
2627

27-
auto contains(const value_type &value, const hash_type hash) const -> bool;
28-
inline auto contains(const value_type &value) const -> bool {
28+
auto contains(const string_type &value, const hash_type hash) const -> bool;
29+
inline auto contains(const string_type &value) const -> bool {
2930
return this->contains(value, this->hasher(value));
3031
}
3132

32-
inline auto at(const size_type index) const noexcept
33-
-> const std::pair<value_type, hash_type> & {
33+
inline auto at(const size_type index) const noexcept -> const value_type & {
3434
return this->data[index];
3535
}
3636

37-
auto insert(const value_type &value) -> void;
38-
auto insert(value_type &&value) -> void;
37+
auto insert(const string_type &value) -> void;
38+
auto insert(string_type &&value) -> void;
3939

4040
inline auto empty() const noexcept -> bool { return this->data.empty(); }
4141
inline auto size() const noexcept -> size_type { return this->data.size(); }
@@ -54,7 +54,7 @@ class SOURCEMETA_BLAZE_EVALUATOR_EXPORT StringSet {
5454
#if defined(_MSC_VER)
5555
#pragma warning(default : 4251 4275)
5656
#endif
57-
sourcemeta::core::PropertyHashJSON<value_type> hasher;
57+
sourcemeta::core::PropertyHashJSON<string_type> hasher;
5858
};
5959

6060
} // namespace sourcemeta::blaze

0 commit comments

Comments
 (0)