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
struct main_task { | |
struct main_promise { | |
using handle_t = std::coroutine_handle<main_promise>; | |
main_task get_return_object() { | |
return main_task{handle_t::from_promise(*this)}; | |
} | |
std::suspend_never initial_suspend() noexcept { return {}; } | |
std::suspend_always final_suspend() noexcept { return {}; } | |
void unhandled_exception() { std::terminate(); } | |
void return_value(int ret) { ret_ = ret; } |
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
================== | |
WARNING: ThreadSanitizer: data race (pid=9616) | |
Read of size 8 at 0x556bf9a5ab58 by thread T4: | |
#0 git_pool__system_page_size external/libgit2/src/pool.c:28 (demo+0x6a932) | |
#1 git_pool_init external/libgit2/src/pool.c:47 (demo+0x6aa4f) | |
#2 git_sortedcache_new external/libgit2/src/sortedcache.c:28 (demo+0x98769) | |
#3 git_refdb_backend_fs external/libgit2/src/refdb_fs.c:2152 (demo+0x754b2) | |
#4 git_refdb_open external/libgit2/src/refdb.c:49 (demo+0x6d201) | |
#5 git_repository_refdb__weakptr external/libgit2/src/repository.c:1152 (demo+0x9252e) | |
#6 git_reference_lookup_resolved external/libgit2/src/refs.c:237 (demo+0x7bf5e) |
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
# googleapis | |
http_archive( | |
name = "com_google_googleapis", | |
sha256 = "0744d1a1834ab350126b12ebe2b4bb1c8feb5883bd1ba0a6e876cb741d569994", | |
strip_prefix = "googleapis-bcc476396e799806d3355e87246c6becf6250a70", | |
urls = ["https://github.com/googleapis/googleapis/archive/bcc476396e799806d3355e87246c6becf6250a70.tar.gz"], | |
) | |
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") | |
switched_rules_by_language( |
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 <cmath> | |
#include <iostream> | |
using namespace std; | |
template <int value> struct Test { int test() { return value; } }; | |
template <> struct Test<0> { int test() { return 0; } }; | |
int main() | |
{ | |
Test<static_cast<int>(floor(0.5))> a; |
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 "FastLineReader.h" | |
// POSIX | |
#include <sys/types.h> | |
#include <sys/mman.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#include <errno.h> |
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> | |
using namespace std; | |
struct A | |
{ | |
int p_value; | |
void print() { cout << "Value = \"" << p_value << "\"." << endl; } | |
}; | |
template < typename T > |
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
simon@lenovo:~/repos/teaching/examples/PB161> ./a.out | |
dry run 499994165 | |
Accumulate runtime 28169000 - 499994165 | |
Manual sum runtime 44949000 - 499994165 | |
simon@lenovo:~/repos/teaching/examples/PB161> ./a.out | |
dry run 499996968 | |
Accumulate runtime 32467000 - 499996968 | |
Manual sum runtime 44659000 - 499996968 | |
simon@lenovo:~/repos/teaching/examples/PB161> ./a.out | |
dry run 500024233 |
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 <vector> | |
#include <cstdint> | |
#include <iostream> | |
using namespace std; | |
class BitmapWriter | |
{ | |
public: | |
struct RGB { unsigned char red; unsigned char green; unsigned char blue; |
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 "node.h" | |
#include "nodeiter.h" | |
#include <iostream> | |
#include <memory> | |
#include <list> | |
using namespace std; | |
int main() | |
{ |
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
g++ -std=c++11 -pedantic -Wall -Wextra -ggdb3 -D_GLIBCXX_USE_NANOSLEEP -D_GLIBCXX_USE_SCHED_YIELD -lpthread main.cpp node.cpp |