wasphin commented on a change in pull request #1484:
URL: https://github.com/apache/incubator-brpc/pull/1484#discussion_r671696210
##########
File path: docs/cn/flatmap.md
##########
@@ -4,7 +4,35 @@ FlatMap - Maybe the fastest hashmap, with tradeoff of space.
# EXAMPLE
-`#include <butil/containers/flat_map.h>`
+```c++
+#include <string>
+#include <butil/logging.h>
+#include <butil/containers/flat_map.h>
+
+void flatmap_example() {
+ butil::FlatMap<int, std::string> map;
+ // bucket_count: initial count of buckets, big enough to avoid resize.
+ // load_factor: element_count * 100 / bucket_count, 80 as default.
+ int bucket_count = 1000;
+ int load_factor = 80;
+ map.init(bucket_count, load_factor);
+ map.insert(10, "hello");
+ map[20] = "world";
+ std::string* value = map.seek(20);
+ CHECK(value != NULL)
Review comment:
少一个 `;`
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]