http://d.puremagic.com/issues/show_bug.cgi?id=5347
Summary: Add constructors for primitive types to make pointers easier to use Product: D Version: unspecified Platform: Other OS/Version: Linux Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: jmdavisp...@gmx.com --- Comment #0 from Jonathan M Davis <jmdavisp...@gmx.com> 2010-12-13 00:10:50 PST --- I'd like to be able to do something like this: int* i = new int(7); It would create a new pointer to int where the int that it points to has a value of 7. But that code results in the compiler complaining that there is no constructor for int, and as far as I can tell the only way to do it so the far less elegant and definitely less compact: int* i = new int; *i = 7; Ideally, you'd be able to use the first syntax for all primitive types. As it is however, you can only use it for structs (and classes if you're using a reference rather than a pointer). This seems unnecessarily limiting. In fact, I thought that the first syntax _was_ legal, and it threw me off when it didn't work (just goes to show how rarely I use pointers, I guess). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------