Struct fields and properties as alias members

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Dec 8 17:29:19 UTC 2021


On Wed, Dec 08, 2021 at 05:19:32PM +0000, Ben Jones via Digitalmars-d-learn wrote:
> I'm trying to use a property member of a struct as a template alias
> parameter and I don't really understand how to fix the error message
> I'm seeing (I also tried the simpler case of a plain struct member,
> and that didn't work either).  Is what I'm trying to do possible?  It
> seems like maybe I'd have to pass s as a runtime parameter to get it
> to work?

It might help if you elaborate a bit more on what exactly you're trying
to achieve here.  Why can't you just pass the value of the field to the
function as a runtime parameter, for example, which would be the usual
way of doing it?  Is there something specific you're trying to achieve
here that requires using a template parameter?

T

-- 
Being forced to write comments actually improves code, because it is
easier to fix a crock than to explain it. -- G. Steele 


More information about the Digitalmars-d-learn mailing list