Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 37eeaed

Browse files
authored
compare_keys is unused when NDEBUG is defined. (#221)
Put an ifdef around it to avoid a warning.
1 parent 27f3e74 commit 37eeaed

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

opencensus/tags/internal/tag_map.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ TagMap::TagMap(std::vector<std::pair<TagKey, std::string>> tags)
4848
void TagMap::Initialize() {
4949
std::sort(tags_.begin(), tags_.end());
5050

51+
#ifndef NDEBUG
5152
auto compare_keys = [](const std::pair<TagKey, std::string>& a,
5253
const std::pair<TagKey, std::string>& b) {
5354
return a.first == b.first;
5455
};
5556
assert(std::adjacent_find(tags_.begin(), tags_.end(), compare_keys) ==
5657
tags_.end() &&
5758
"Duplicate keys are not allowed in TagMap.");
59+
#endif
5860

5961
std::hash<std::string> hasher;
6062
common::HashMix mixer;

0 commit comments

Comments
 (0)