Skip to content

Commit

Permalink
Fix code example of for_each_prefix_of in comment (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice authored Aug 26, 2024
1 parent d6a7d8a commit d98d603
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions include/tsl/htrie_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -561,16 +561,16 @@ class htrie_map {
* Example:
*
* tsl::htrie_map<char, int> map = {{"/foo", 1}, {"/foo/bar", 2}};
* auto print = [](tsl::htrie_map<char>::iterator it) {
* auto print = [](tsl::htrie_map<char, int>::iterator it) {
* std::cout << it.key() << "\n";
* };
*
* map.for_each_prefix_of("/foo", print); // prints "/foo"
* map.for_each_prefix_of("/foo/baz"); // prints nothing
* map.for_each_prefix_of("/foo/bar/baz"); // prints nothing
* map.for_each_prefix_of("/foo/bar/"); // prints "/foo" and "/foo/bar"
* map.for_each_prefix_of("/bar"); // prints nothing
* map.for_each_prefix_of(""); // prints nothing
* map.for_each_prefix_of("/foo/baz", print); // prints "/foo"
* map.for_each_prefix_of("/foo/bar/baz", print); // prints "/foo" and "/foo/bar"
* map.for_each_prefix_of("/foo/bar/", print); // prints "/foo" and "/foo/bar"
* map.for_each_prefix_of("/bar", print); // prints nothing
* map.for_each_prefix_of("", print); // prints nothing
*/
template <typename F>
void for_each_prefix_of_ks(const CharT* key, size_type key_size,
Expand Down
10 changes: 5 additions & 5 deletions include/tsl/htrie_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,11 @@ class htrie_set {
* };
*
* set.for_each_prefix_of("/foo", print); // prints "/foo"
* set.for_each_prefix_of("/foo/baz"); // prints nothing
* set.for_each_prefix_of("/foo/bar/baz"); // prints nothing
* set.for_each_prefix_of("/foo/bar/"); // prints "/foo" and "/foo/bar"
* set.for_each_prefix_of("/bar"); // prints nothing
* set.for_each_prefix_of(""); // prints nothing
* set.for_each_prefix_of("/foo/baz", print); // prints "/foo"
* set.for_each_prefix_of("/foo/bar/baz", print); // prints "/foo" and "/foo/bar"
* set.for_each_prefix_of("/foo/bar/", print); // prints "/foo" and "/foo/bar"
* set.for_each_prefix_of("/bar", print); // prints nothing
* set.for_each_prefix_of("", print); // prints nothing
*/
template <typename F>
void for_each_prefix_of_ks(const CharT* key, size_type key_size,
Expand Down

0 comments on commit d98d603

Please sign in to comment.