Skip to content

Instantly share code, notes, and snippets.

@charsyam
Created March 1, 2021 13:28
Show Gist options
  • Save charsyam/8a2782a8a0a9772513d451ae54304465 to your computer and use it in GitHub Desktop.
Save charsyam/8a2782a8a0a9772513d451ae54304465 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <folly/ConcurrentSkipList.h>
static std::string makeRandomeString(int len) {
std::string s;
for (int j = 0; j < len; j++) {
s.push_back((rand() % 26) + 'A');
}
return s;
}
int main(int argc, char *argv[]) {
typedef folly::ConcurrentSkipList<std::string> SkipListT;
auto skip(SkipListT::create(2));
for (int i = 0; i < 100000; i++) {
std::string s = makeRandomeString(7);
skip.add(s);
}
auto it = skip.begin();
std::cout << skip.contains(*it) << std::endl;
for (const auto &s : skip) {
std::cout << s << std::endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment