Skip to content

Instantly share code, notes, and snippets.

View artemkin's full-sized avatar
🎯
Focusing

Stas artemkin

🎯
Focusing
View GitHub Profile
// Special case of memoization. Only last value is cached.
#include <iostream>
#include <memory>
template<typename R, typename Arg, typename Comp = std::equal_to<Arg>, typename Fun>
std::function<R(const Arg&)> memoize_last(Fun f)
{
struct Cache
{

Keybase proof

I hereby claim:

  • I am artemkin on github.
  • I am stas (https://keybase.io/stas) on keybase.
  • I have a public key whose fingerprint is 9D25 6F3B FE9A 0ADF E7E5 D03E 5D55 61F3 B009 1428

To claim this, I am signing this object: