C++ links: Coroutines
https://github.com/MattPD/cpplinks / C++ Standard / C++20 / Coroutines
(draft; work in progress)
#coroutines (C++ Slack): https://cpplang.slack.com/archives/C5JS5JXT5
############################################# | |
# ----------- | |
# Import from conan only. | |
# ----------- | |
conan_pkgs= { | |
'fmt':'fmt/5.3.0@', # <- Must contain @, otherwise Conan will think it is a path | |
# ... the dependency list goes on | |
} | |
# Adding new dependencies to this dict is error-free, but if you |
#!/usr/bin/env bash | |
function register_clang_version { | |
local version=$1 | |
local priority=$2 | |
update-alternatives \ | |
--verbose \ | |
--install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${version} ${priority} \ | |
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-${version} \ |
dvloginov@dvloginov-vbox:~/work/dpdk_ring_tsan$ meson test -v -C buildDir | |
ninja: no work to do. | |
ninja: Entering directory `/home/dvloginov/work/dpdk_ring_tsan/buildDir' | |
ninja: no work to do. | |
1/1 rint_tst RUNNING | |
>>> MALLOC_PERTURB_=164 /home/dvloginov/work/dpdk_ring_tsan/buildDir/dpdk_ring_tsan --no-pci --no-hpet --no-huge --no-shconf --log-level=lib.eal:debug '-m 1024' | |
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ✀ ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― | |
==75767==Installed the sigaction for signal 11 | |
==75767==Installed the sigaction for signal 7 | |
==75767==Installed the sigaction for signal 8 |
CFLAGS = -std=c99 -Wall | |
main : main.o | |
.PHONY : test clean | |
test : main | |
./$^ "*regex*" "*vtable*" < main.c | |
clean : |
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"sync/atomic" | |
"go.opentelemetry.io/otel" | |
"go.opentelemetry.io/otel/metric" |
# Cleanup old alternatives | |
update-alternatives --remove-all cc | |
update-alternatives --remove-all c++ | |
update-alternatives --remove-all gcc | |
update-alternatives --remove-all g++ | |
update-alternatives --remove-all clang | |
update-alternatives --remove-all clang++ | |
update-alternatives --remove-all icc | |
update-alternatives --remove-all icc++ |
https://github.com/MattPD/cpplinks / C++ Standard / C++20 / Coroutines
(draft; work in progress)
#coroutines (C++ Slack): https://cpplang.slack.com/archives/C5JS5JXT5
class Solution { | |
public: | |
int compress(vector<char>& chars) { | |
int n = chars.size(); | |
if (n <= 1) return n; | |
int j = 0, i = 0; | |
while (i < n) { | |
int k = i; | |
// skip duplicates | |
while ((k + 1 < n) && chars[k] == chars[k + 1]) { |
string compression(const string & str){ | |
int i = str.size(); | |
string letters; | |
for (int j = 0; j < i; ++j){ | |
int count = 1; | |
while (str[j] == str[j+1]){ | |
count++; | |
j++; | |
} |
// based on https://stackoverflow.com/a/60080443 | |
#define RETURNS(...) \ | |
noexcept(noexcept(__VA_ARGS__)) \ | |
-> decltype(__VA_ARGS__) \ | |
{ return __VA_ARGS__; } | |
template<class T, | |
typename std::enable_if< !std::is_class<T>{}, bool>::type = true | |
> |