title: Detect at compile time if a function is executed in a static context, C++20
body: <p>Can I detect via templates, concepts or in any other constexpr way if a function is being run in a static context? Something like this:</p>
  <pre class="lang-cpp prettyprint-override"><code>template &lt;typename T = SomeTypeIfImStatic_SomeOtherTypeIfImNot&gt;
  class FBlah
  {
      void foo()
      {
          if constexpr (AmIStatic) { ... } else { ... }
      }
  };
  </code></pre>
  <p>Alternatively, like this:</p>
  <pre class="lang-cpp prettyprint-override"><code>template &lt;typename T = SomeTypeIfImStatic_SomeOtherTypeIfImNot&gt;
  class FBlah
  {
  };
  </code></pre>
  <p>Would like to differentiate between being run in a <code>static FBlah Blah;</code> or an <code>FBlah Blah;</code> inside of an <code>FBlah</code> itself.</p>
  <p>I'm aware that I could declare two types, one for static <code>FBlah</code> the other for non-static but I'm looking for a compile-time way to do this. I'm using C++20.</p>