Re: class template conflict

2018-12-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/23/18 7:09 AM, Michelle Long wrote: class X { } class X(int N) : X { } Is there any real reason we can't do this? I think it has less to do with class names and more to do with symbol overloading. The only place I think templates are allowed to overload names with non-templates

Re: class template conflict

2018-12-23 Thread Michelle Long via Digitalmars-d-learn
More simple is : do not use the same identifier ;) The whole point is to use the same identifier ;/

Re: Best Way to Pass Template Typed Alias Parameters for Functions?

2018-12-23 Thread Vijay Nayar via Digitalmars-d-learn
On Sunday, 23 December 2018 at 19:10:06 UTC, Alex wrote: On Sunday, 23 December 2018 at 18:53:15 UTC, Vijay Nayar wrote: You're right, it does compile. I'm a bit surprised. I wonder if this is a relatively recent improvement in the language, because last time I ran into this I had no such

Re: Where do I learn to use GtkD

2018-12-23 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 30 October 2018 at 04:22:21 UTC, helxi wrote: On Sunday, 13 March 2016 at 19:28:57 UTC, karabuta wrote: Gtk3 from python3 has got I nice book with examples that are not so advanced but enough to get you doing real work(from a beginner point of view). GtkD seem to have changed the

Re: Best Way to Pass Template Typed Alias Parameters for Functions?

2018-12-23 Thread Alex via Digitalmars-d-learn
On Sunday, 23 December 2018 at 18:53:15 UTC, Vijay Nayar wrote: You're right, it does compile. I'm a bit surprised. I wonder if this is a relatively recent improvement in the language, because last time I ran into this I had no such luck. But after seeing that your example did work, I figured

Re: Best Way to Pass Template Typed Alias Parameters for Functions?

2018-12-23 Thread Vijay Nayar via Digitalmars-d-learn
On Sunday, 23 December 2018 at 18:31:24 UTC, Alex wrote: On Sunday, 23 December 2018 at 18:13:25 UTC, Vijay Nayar wrote: For example, if you have a const function in your container like "T find() const", and this function needs to use that comparator, then you're out of luck because the

Re: Best Way to Pass Template Typed Alias Parameters for Functions?

2018-12-23 Thread Alex via Digitalmars-d-learn
On Sunday, 23 December 2018 at 18:13:25 UTC, Vijay Nayar wrote: I've been playing with the idea of specifying the constraints or using "static assert" in the constructor. They are good options, but there's a few cases where they fall a bit short. For example, imagine you have a container

Re: Best Way to Pass Template Typed Alias Parameters for Functions?

2018-12-23 Thread Vijay Nayar via Digitalmars-d-learn
On Sunday, 23 December 2018 at 18:04:32 UTC, Alex wrote: On Sunday, 23 December 2018 at 17:13:49 UTC, Vijay Nayar wrote: I have a few cases where I would like to pass in a function as a value to a template, but I want to ensure that the function takes certain kinds of parameters, is a const

Re: Best Way to Pass Template Typed Alias Parameters for Functions?

2018-12-23 Thread Alex via Digitalmars-d-learn
On Sunday, 23 December 2018 at 17:13:49 UTC, Vijay Nayar wrote: I have a few cases where I would like to pass in a function as a value to a template, but I want to ensure that the function takes certain kinds of parameters, is a const function, or matches any other set of conditions. What is

Best Way to Pass Template Typed Alias Parameters for Functions?

2018-12-23 Thread Vijay Nayar via Digitalmars-d-learn
I have a few cases where I would like to pass in a function as a value to a template, but I want to ensure that the function takes certain kinds of parameters, is a const function, or matches any other set of conditions. What is the best way to do this? Just to avoid any potential confusion,

Re: class template conflict

2018-12-23 Thread Basile B. via Digitalmars-d-learn
On Sunday, 23 December 2018 at 12:09:31 UTC, Michelle Long wrote: class X { } class X(int N) : X { } Is there any real reason we can't do this? It is very nice to be able to treat X like the base and X!n as a derived class. Sure we can do class X(int N) : X!0 { static if(N == 0) {

cas and interfaces

2018-12-23 Thread Johannes Loher via Digitalmars-d-learn
I recently played around with atomic operations. While doing so, I noticed a problem with the interaction of interfaces and cas. Consider the following program: ``` import core.atomic; import std.stdio; interface TestInterface { } class TestClass : TestInterface { } void main() { shared

class template conflict

2018-12-23 Thread Michelle Long via Digitalmars-d-learn
class X { } class X(int N) : X { } Is there any real reason we can't do this? It is very nice to be able to treat X like the base and X!n as a derived class. Sure we can do class X(int N) : X!0 { static if(N == 0) { } } but this is very ugly, in my code I always have to use X!0