Skip to content

Instantly share code, notes, and snippets.

View Cryolite's full-sized avatar

Cryolite Cryolite

View GitHub Profile
#include <type_traits>
void f(std::integral_constant<int, 0>);
template<int I>
auto f(std::integral_constant<int, I>)
-> decltype(f(std::integral_constant<int, I - 1>()));
int main()
{
#include <iostream>
struct S
{
S(int i) : i_(i) {}
S(S const &) = delete;
S(S &&) = delete;
void double_() { i_ *= 2; }
int get() const { return i_; }
#include <functional>
#include <iostream>
class C
{
public:
C() : i_() {}
std::function<void(int)> set = [this](int i) mutable { this->i_ = i; };
std::function<int()> get = [this]() { return this->i_; };