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
void vector_capacity_reserve() { | |
// How to set the capacity of a vector? | |
// .reserve() | |
std::vector<int> new_faces; | |
new_faces.reserve(1000); | |
assert(new_faces.size() == 0) | |
} |
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
/* | |
Copyright Sohail 2016 | |
This visualises how the actual order of execution varies in a multi-threaded program, in a practical situation. | |
A central problem in multithreaded is the fact that we cannot predict (and there is absolutely no guarantee regarding) the sequence in which the actual execution is performed. | |
Features example use of std::thread(), std::mutex, std::unique_lock<>, and the methods join(), sleep_for(), sleep_until(). | |
Four simple experiments in multi-thread programming in C++11/14. | |
The 4 Experiments in the reverse order: |
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
<!DOCTYPE html> | |
<!-- Playing with RxJS 5.0 --> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Buffer</title> | |
<script src="https://npmcdn.com/@reactivex/[email protected]/dist/global/Rx.umd.js"></script> | |
</head> | |
<body> |