Skip to content

Instantly share code, notes, and snippets.

View matgrioni's full-sized avatar

Matias Grioni matgrioni

View GitHub Profile
@foxcpp
foxcpp / locked.hpp
Created January 27, 2020 19:03
std::shared_mutex + T value wrapper
#pragma once
#include <memory>
#include <shared_mutex>
/*
* std::shared_mutex + T value wrapper written out of boredom.
* Needs C++17 support to compile.
*
* It phohibits direct manipulation of T value without locking the mutex in