This file contains hidden or 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> | |
void pairtest(void *p) | |
{ | |
std::pair<int**, std::string> *pr = | |
static_cast<std::pair<int**, std::string>* >(p); | |
int **i = pr->first; | |
std::cout << **i << "\n"; |
This file contains hidden or 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 "helper.h" | |
#include <cstring> | |
#include <string> | |
#include <iostream> | |
extern "C" { | |
void get_names(char names[][LENGTH], int *nums, int count) { | |
std::string snames[] = { "abc", "def", "ghi", "xxx", "zzz", "aa", "BBBBB", "cc", "AAAA", "FFFFFFF" }; | |
for (int i=0; i<count; i++) { |
This file contains hidden or 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
// https://godbolt.org/z/5Yj9hv1dv | |
#include <tuple> | |
template <auto...> | |
struct Vector; | |
template <typename...> | |
struct zip; |
This file contains hidden or 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 <chrono> | |
#include <vector> | |
#include <random> | |
#include <algorithm> | |
#include <map> | |
#include <set> | |
auto vecTest(const int size, std::mt19937 &rng, std::uniform_int_distribution<std::mt19937::result_type> &dist) { | |
auto begin= std::chrono::system_clock::now(); |
This file contains hidden or 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 <vector> | |
#include <algorithm> | |
#include <unordered_set> | |
#include <iostream> | |
// https://godbolt.org/z/Ehd85Ws18 | |
// https://quick-bench.com/q/69J3sKtK9ScVWESLIrZDn7chyzY | |
template <typename T> | |
void copyStableWithoutDuplicates(const std::vector<T>& from, std::vector<T>& to) { |
This file contains hidden or 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 <vector> | |
#include <algorithm> | |
#include <unordered_map> | |
#include <iostream> | |
// https://godbolt.org/z/Toc3T95oW | |
// https://quick-bench.com/q/tIZ8WWzcixs_ktnadmqa1T3t4Bw | |
template <typename T> | |
void copyStableOnlyDuplicates(const std::vector<T>& from, std::vector<T>& to) { |
This file contains hidden or 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 <tuple> | |
#include <vector> | |
#include <set> | |
#include <map> | |
#include <string> | |
#include <iostream> | |
#include <ranges> | |
#include <deque> | |
#include <concepts> | |
#include <cassert> |
This file contains hidden or 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 <unordered_map> | |
#include <math.h> | |
#include <cassert> | |
class Fib { | |
public: | |
Fib() : last(1), memo{{0,0},{1,1}} { } | |
unsigned long operator()(unsigned int n) { | |
assert(n < 94); // overflow after this |