opCast using in template struct
Era Scarecrow
rtcvb32 at yahoo.com
Thu Oct 18 22:58:27 PDT 2012
On Thursday, 18 October 2012 at 23:51:44 UTC, Timon Gehr wrote:
>If the issue _is_ with the signature, then the compiler should
>tell you. That is the (secondary) job of the compiler.
But not everything is parsed/compiled if it doesn't match the
constraints, especially template functions. Sometimes I wish I
had more information of what signatures it generated, what it
compared against, and why each of them were disqualified; But
that's regarding more complex stuff.
> That is a lot better, but what if the typo is within the first
> 3 characters? :o)
If the beginning doesn't match 'op(Op)?[A-Z]', then you can't
safely guess it was ever intended to override operators. If it
has the keyword override then you know in a class it's
polymorphic, however in a struct.... Hmmm... i don't know.
Maybe a small suite list of tests that go through a few dozen
templates and tells you what a struct qualifies for, like ranges,
random access, forward/reverse, infinite. Etc. Might be more
informational but if you expect you struct to do something and it
doesn't qualify then you have a better idea at least of what is
wrong.
More information about the Digitalmars-d-learn
mailing list