Skip to content

Commit

Permalink
fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
martinzink committed Jul 31, 2023
1 parent 0fa35d6 commit 25306bf
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions libminifi/include/utils/FlatMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,17 @@ class FlatMap{
return data_.rbegin()->second;
}

const V& at(std::equality_comparable_with<K> auto const& key) const {
template<std::equality_comparable_with<K> T>
const V& at(const T& key) const {
auto it = find(key);
if (it != end()) {
return it->second;
}
throw std::out_of_range("utils::FlatMap::at");
}

V& at(std::equality_comparable_with<K> auto const& key) {
template<std::equality_comparable_with<K> T>
V& at(const T& key) {
auto it = find(key);
if (it != end()) {
return it->second;
Expand All @@ -168,7 +170,8 @@ class FlatMap{
return iterator{data_.begin() + offset};
}

std::size_t erase(std::equality_comparable_with<K> auto const& key) {
template<std::equality_comparable_with<K> T>
std::size_t erase(const T& key) {
for (auto it = data_.begin(); it != data_.end(); ++it) {
if (it->first == key) {
std::swap(*data_.rbegin(), *it);
Expand Down Expand Up @@ -210,14 +213,16 @@ class FlatMap{
return {iterator{data_.begin() + data_.size() - 1}, true};
}

iterator find(std::equality_comparable_with<K> auto const& key) {
template<std::equality_comparable_with<K> T>
iterator find(const T& key) {
for (auto it = data_.begin(); it != data_.end(); ++it) {
if (it->first == key) return iterator{it};
}
return end();
}

const_iterator find(std::equality_comparable_with<K> auto const& key) const {
template<std::equality_comparable_with<K> T>
const_iterator find(const T& key) const {
for (auto it = data_.begin(); it != data_.end(); ++it) {
if (it->first == key) return const_iterator{it};
}
Expand Down Expand Up @@ -284,7 +289,8 @@ class FlatMap{
return data_.empty();
}

bool contains(std::equality_comparable_with<K> auto const& key) const {
template<std::equality_comparable_with<K> T>
bool contains(const T& key) const {
return find(key) != end();
}

Expand Down

0 comments on commit 25306bf

Please sign in to comment.