Skip to content

Instantly share code, notes, and snippets.

git log --date=local --format="%cD" --stat --no-merges
@kfish
kfish / arbitrary-variant.hpp
Created August 11, 2018 04:49
Rapidcheck(C++) Arbitrary instance for `std::variant`
// An Arbitrary instance generator for std::variant, for
// Rapidcheck: https://github.com/emil-e/rapidcheck
#include <variant>
namespace rc {
template<>
struct Arbitrary<std::monostate> {
static Gen<std::monostate> arbitrary() {
@kfish
kfish / cpp_static_inline_extern.md
Last active June 11, 2024 22:34
C++ Visibility and Linkage of static, inline and extern

Visibility and Linkage of static, inline, and extern

static inline

// foo.h
static inline bool use_foo = true;
  • static: Limits the variable's linkage to the current translation unit. Each translation unit (source file including this header) will have its own separate instance of use_foo.