P
psujkov
Hi everybody,
let us have some class A with const static int variable var with
compile-time well-known value. let us have some function f(), which
has return type of A. and let us have some template struct with non-
type template parameter : template <int a> Z. having it all there is a
question : why we cannot write smth like this : Z< f()::var> z ? there
is no need in real call to function f - it can be not defined as all
(declared only), because all we need is a static const variable value.
So why compiler does not let us to do so ? N.B. the one and only
operator that works in this example is sizeof, but I cannot see ant
real difference between sizeof and getting static const variable
value. And is there some way to avoid this error ? Maybe some
workarounds in std or boost I don't know about ?..
Best Regards, Paul Sujkov
let us have some class A with const static int variable var with
compile-time well-known value. let us have some function f(), which
has return type of A. and let us have some template struct with non-
type template parameter : template <int a> Z. having it all there is a
question : why we cannot write smth like this : Z< f()::var> z ? there
is no need in real call to function f - it can be not defined as all
(declared only), because all we need is a static const variable value.
So why compiler does not let us to do so ? N.B. the one and only
operator that works in this example is sizeof, but I cannot see ant
real difference between sizeof and getting static const variable
value. And is there some way to avoid this error ? Maybe some
workarounds in std or boost I don't know about ?..
Best Regards, Paul Sujkov