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:
template <typename T = SomeTypeIfImStatic_SomeOtherTypeIfImNot>
class FBlah
{
void foo()
{
if constexpr (AmIStatic) { ... } else { ... }
}
};
Alternatively, like this:
template <typename T = SomeTypeIfImStatic_SomeOtherTypeIfImNot>
class FBlah
{
};
Would like to differentiate between being run in a static FBlah Blah;
or an FBlah Blah;
inside of an FBlah
itself.
I'm aware that I could declare two types, one for static FBlah
the other for non-static but I'm looking for a compile-time way to do this. I'm using C++20.