Skip to content

Instantly share code, notes, and snippets.

View RicoJia's full-sized avatar
🎯

RicoJia

🎯
View GitHub Profile
@stavalfi
stavalfi / Cpp lvalue rvalue and between By Stav Alfi.md
Last active November 27, 2021 20:33
C++ lvalue, rvalue and between By Stav Alfi
@kjelloh
kjelloh / refernce_to_reference_implies_value_assign.cpp
Last active May 16, 2020 03:00
C++ - Can't pass reference to reference (value assign is implied)
struct foo {
foo& operator=(const foo& other) = delete; // foo is not copy-assignable
};
void bar() {
foo f1;
foo& r1 = f1; // Ok. r1 is reference to f1.
foo& r2 = r1; // ok. r2 is refernce to r1 which is semanticly the value f1.
r2 = r1; // Error. Semantics implies value assign (although both sides are references) and foo instance f1 is not assignable.
@exallium
exallium / thread.cpp
Created February 19, 2012 16:37
Boost Multithread Example
#include <iostream>
#include <boost/thread.hpp>
using namespace std;
using boost::thread;
using boost::mutex;
mutex a;
const int THREAD_COUNT = 10;