Template constraints: opCmp and opUnary!"++"

Philippe Sigaud philippe.sigaud at gmail.com
Fri Dec 20 09:50:56 PST 2013


On Fri, Dec 20, 2013 at 6:31 PM, Francesco Cattoglio
<francesco.cattoglio at gmail.com> wrote:
> On Friday, 20 December 2013 at 16:40:23 UTC, monarch_dodra wrote:
>>>
>>> Everything works as it should, but according to "D Templates: A Tutorial"
>>> book, you should not use arguments in constraints.
>>
>>
>> That's news to me.
>
> It seems strange to me too, but: page 69 on the PDF:
> "Do not use argument in your constraint. If you need a value of type T, use
> T.init."
> Since I don't know D really well, I thought something was wrong with it.

Well I wrote this, so I should explain :-)

I'm pretty sure at one time, using direct symbols led to strange
behavior. And I'm still not sure symbol have values when used in
template constraints. What happens when you try ++a on such a symbol?

But then, if people tell me using these values directly is perfectly
OK, I'll update the text, of course.


More information about the Digitalmars-d-learn mailing list