Question about __treats

rikki cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 21 00:09:01 PDT 2016


On 21/09/2016 7:06 PM, Suliman wrote:
> It's seems that __treats is language keyword that help to get info from
> compile-time. But there is also lib named std.traits
>
> and I can't understand difference
>
> https://dlang.org/spec/traits.html
> https://dlang.org/phobos/std_traits.html
>
> Could you explain the difference?

Simple, __traits or __treats as you called it is implemented by the 
compiler.
But std.traits is all implemented in the standard library as user D code.

If you can do it with std.traits you should. Otherwise __traits.
So std.traits is a bit higher level and there are more things available 
there as adding more __traits is a bit rare.


More information about the Digitalmars-d-learn mailing list