On 04/10/2019 05:07 AM, Ron Tarrant wrote:
>> the book's index:
>>
>> http://ddili.org/ders/d.en/ix.html
> Oops!
Not at all. One of the most useful parts of the book has been the index
section for me. I occasionally search in there... like just yesterday
for the positional format specifier
On Wednesday, 10 April 2019 at 00:42:11 UTC, Ali Çehreli wrote:
Your code did not work because Point is not a type but a type
template. (On the other hand, Point!double is a type). The
whole program:
Thanks very much, Ali! Obviously, I've got some studying ahead of
me.
On Wednesday, 10 April 2019 at 00:22:47 UTC, Ali Çehreli wrote:
On 04/08/2019 05:23 AM, Ron Tarrant wrote:
> But in "Programming in D," (self, 2009-2018) by Ali Çehreli,
there's no
> mention of the 'template' keyword in any of his examples.
'template' keyword is introduced here:
On Tuesday, 9 April 2019 at 20:48:45 UTC, Steven Schveighoffer
wrote:
The thing that made it click for me is that a template is very
akin to a macro substitution -- where you just copy and paste
the given parameter wherever its substitute is found.
Nicely put. Thanks, Steve. I at least get
On Wednesday, 10 April 2019 at 00:42:11 UTC, Ali Çehreli wrote:
(It may be made to work with Adam's (T : Point!R, R) syntax but
I failed just now.)
You know, I didn't think T : Point!T would work, but it does. Huh.
Anyway, the , R one works similarly, observe:
---
T getResponse(T : Point!R,
On 04/08/2019 05:59 AM, Ron Tarrant wrote:
On Monday, 8 April 2019 at 12:40:10 UTC, Adam D. Ruppe wrote:
You don't need template keyword for the majority of cases because the
compiler lets you do shortcuts.
Thanks, Adam. Good to know.
(maybe I am looking at the wrong part of the book, it is
On 04/08/2019 05:23 AM, Ron Tarrant wrote:
> But in "Programming in D," (self, 2009-2018) by Ali Çehreli, there's no
> mention of the 'template' keyword in any of his examples.
'template' keyword is introduced here:
http://ddili.org/ders/d.en/templates_more.html#ix_templates_more.template
I
On Tue, Apr 09, 2019 at 04:48:45PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 4/9/19 4:31 PM, Ron Tarrant wrote:
>
> > I'm still struggling to understand templates, but I'll keep at it.
[...]
> The thing that made it click for me is that a template is very akin to
> a macro
On 4/9/19 4:31 PM, Ron Tarrant wrote:
I'm still struggling to understand templates, but I'll keep at it.
When I first saw C++ templates, I thought "what the hell is this black
magic", and had no idea how they worked. In fact, this was back before
STL, and I recall it was a set of templates
On Tuesday, 9 April 2019 at 14:41:30 UTC, Alex wrote:
Your confusion arises in your understanding of meta programming
and templates. Templates are compile time expressions that use
parameters.
This sounds like another 'no.' :)
Thanks for all the info, Alex.
On Tuesday, 9 April 2019 at 14:25:18 UTC, Mike Parker wrote:
Off the top of my head, to get a Singleton template, you could
implement all of your singleton plumbing (thread safety if you
need it, etc) in the template and add a `static _instance`
member just as you would for any non-templated
On Monday, 8 April 2019 at 12:23:28 UTC, Ron Tarrant wrote:
I'm digging into templates in an attempt to understand the
signals-n-slots replacement for the observer pattern, but I've
got a question I can't seem to find an answer for and an
example for which I'm unable to solve the error.
On Tuesday, 9 April 2019 at 10:53:49 UTC, Ron Tarrant wrote:
On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote:
In the subsequent sections, I show both long and short
(eponymous) forms of enum and function templates.
In your book, Mike, you stated:
Remember, a template is only
On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote:
In the subsequent sections, I show both long and short
(eponymous) forms of enum and function templates.
In your book, Mike, you stated:
Remember, a template is only instantiated once for each set of
arguments and
the same
On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote:
In the subsequent sections, I show both long and short
(eponymous) forms of enum and function templates.
Forgot to say...
I'm typing in the examples as I go and so far I haven't been
lost. Even when you don't come right out and say
On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote:
You should have read further along in that chapter :-)
LOL! Actually, after reading Adam's reply, I dug back into your
book and I'm starting to get a reasonable handle on this. I must
say, I like the slow-but-steady intro you
On Monday, 8 April 2019 at 12:23:28 UTC, Ron Tarrant wrote:
First, the question...
In Michael Parker's book, "Learning D," (Packt, 2015) on page
160 he gives an example of a basic template:
template MyTemplate(T)
{
T val;
void printVal()
{
import std.stdio : writeln;
On Monday, 8 April 2019 at 12:40:10 UTC, Adam D. Ruppe wrote:
You don't need template keyword for the majority of cases
because the compiler lets you do shortcuts.
Thanks, Adam. Good to know.
(maybe I am looking at the wrong part of the book, it is hard
to find the right section/page number
On Monday, 8 April 2019 at 12:23:28 UTC, Ron Tarrant wrote:
But in "Programming in D," (self, 2009-2018) by Ali Çehreli,
there's no mention of the 'template' keyword in any of his
examples.
You don't need template keyword for the majority of cases because
the compiler lets you do shortcuts.
19 matches
Mail list logo