Struct with default ctor (Was: [dmd-beta] dmd 2.064 beta take 2)

deadalnix deadalnix at gmail.com
Sat May 18 07:32:09 PDT 2013


On Saturday, 18 May 2013 at 08:19:59 UTC, Dicebot wrote:
> On Saturday, 18 May 2013 at 02:34:46 UTC, Andrej Mitrovic wrote:
>> On 5/18/13, Timothee Cour <thelastmammoth at gmail.com> wrote:
>>> S.init should be known at compile time by the spec.
>>
>> But why is this needed?
>
> It is quite helpful for template / meta-programming stuff. You 
> are always 100% guaranteed that you can construct S.init and 
> use with your weird template magic wihtout extra checks and 
> fallbacks. However, so far most of real-world usages of T.init 
> I have seen is more about template constraint checks where 
> exact T.init value does not matter that much. Any other usage 
> examples in mind?

Within phobos it is used quite heavily.


More information about the Digitalmars-d mailing list