szaszm commented on code in PR #1612:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1612#discussion_r1273600842
##########
libminifi/include/utils/FlatMap.h:
##########
@@ -282,20 +290,18 @@ class FlatMap{
return data_.max_size();
}
- bool empty() const noexcept {
+ [[nodiscard]] bool empty() const noexcept {
return data_.empty();
}
- bool contains(const K& key) const {
+ template<typename T>
+ requires std::equality_comparable_with<K, T>
+ bool contains(const T& key) const {
Review Comment:
I'd use the shortest for that's working with all targeted compilers.
That translates to first fallback to this:
```c++
template<std::equality_comparable_with<K> T>
bool contains(T const& key) const {
```
and second fallback to the original version.
On an unrelated note, we should add `noexcept` wherever it makes sense. It
may make our life easier down the line.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]