Created
March 1, 2021 13:28
-
-
Save charsyam/8a2782a8a0a9772513d451ae54304465 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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