Comment

Comment by kazinator

I implemented exactly the same thing 20 years ago. It looked something like:

  Dynamic<int> foo;  // define at global scope

  {
     DynamicBind<int> foo; // re-bind dynamically
  }
It used thread-local storage and all. The global constructor for the Dynamic<> template class would allocate the thread specific key. The DynamicBind<> template class did the saving, location altering, and restoring.
parent kazinator 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton