1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

Implement operator<< for Suggestions

That way there’s no need to explicitely convert it to a string when
printing it
This commit is contained in:
regnat 2022-03-07 10:04:57 +01:00
parent fd45d85b41
commit 313bbc07a8
3 changed files with 21 additions and 8 deletions

View file

@ -16,7 +16,7 @@ public:
int distance; // The smaller the better
std::string suggestion;
std::string pretty_print() const;
std::string to_string() const;
GENERATE_CMP(Suggestion, me->distance, me->suggestion)
};
@ -25,7 +25,7 @@ class Suggestions {
public:
std::set<Suggestion> suggestions;
std::string pretty_print() const;
std::string to_string() const;
Suggestions trim(
int limit = 5,
@ -39,4 +39,7 @@ public:
Suggestions& operator+=(const Suggestions & other);
};
std::ostream & operator<<(std::ostream & str, const Suggestion &);
std::ostream & operator<<(std::ostream & str, const Suggestions &);
}