On Friday, 23 August 2013 at 22:54:33 UTC, Jonathan M Davis wrote:
Because without static it's a member variable, which means that
you have to
have a constructed object to access it (since it's part of the
object). When
you declare a variable in a class or struct static, then
there's only one for
the entire class or struct, so it can be accessed without an
object. And when
you do StructName.var or ClassName.var your accessing the
variable via the
struct or class rather than an object, so the variable must be
static.
- Jonathan M Davis
But I declared the template static, not the variable.
Is there a better way to pass a ‘member get’ expression to a
template?
I need this for calling ‘.offsetof’ on it, and for checking if
the member's parent is a certain struct type.