Re: Is deprecating a template supposed to work?

2020-02-20 Thread aliak via Digitalmars-d-learn
On Thursday, 20 February 2020 at 23:21:23 UTC, MoonlightSentinel wrote: On Thursday, 20 February 2020 at 22:31:16 UTC, aliak wrote: Is this suppose to give a deprecation error message? deprecated("a") alias A(T) = B!T; template B(T) { alias B = T; } void main() { A!int a; // should th

Re: Conditional Attributes

2020-02-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/18/20 12:11 PM, Marcel wrote: Hello! Say I have a struct where every member function can either be static or not depending on a template parameter. Is there a simple way to do this? Like, for example: struct Foo(Condition) {    static if (Condition) static:    void Bar() {}    void

Re: Regex split ignoore empty and whitespace

2020-02-20 Thread Ali Çehreli via Digitalmars-d-learn
On 2/20/20 4:46 PM, Ali Çehreli wrote: >auto range = std.regex.splitter!(No.keepSeparators)(l, > ctRegex!`[\s-\)\(\.]+`); After realizing that No.keepSeparators is the default value anyway, I tried 'split' and it worked the way you wanted. So, perhaps all you needed was that extra '+' in t

Re: Regex split ignoore empty and whitespace

2020-02-20 Thread Ali Çehreli via Digitalmars-d-learn
On 2/20/20 2:02 PM, AlphaPurned wrote:> std.regex.split(l, ctRegex!`[\s-\)\(\.]`); > > I'm trying too split a string on spaces and stuff... but it is returning > empty strings and other matches(e.g., ()). > > I realize I can delete afterwards but is there a direct way from split > or ctRegex? It

Re: Is deprecating a template supposed to work?

2020-02-20 Thread MoonlightSentinel via Digitalmars-d-learn
On Thursday, 20 February 2020 at 22:31:16 UTC, aliak wrote: Is this suppose to give a deprecation error message? deprecated("a") alias A(T) = B!T; template B(T) { alias B = T; } void main() { A!int a; // should this cause a message "a" ? } ?? Or am I using it wrong maybe? It's a bu

Is deprecating a template supposed to work?

2020-02-20 Thread aliak via Digitalmars-d-learn
Is this suppose to give a deprecation error message? deprecated("a") alias A(T) = B!T; template B(T) { alias B = T; } void main() { A!int a; // should this cause a message "a" ? } ?? Or am I using it wrong maybe?

Regex split ignoore empty and whitespace

2020-02-20 Thread AlphaPurned via Digitalmars-d-learn
std.regex.split(l, ctRegex!`[\s-\)\(\.]`); I'm trying too split a string on spaces and stuff... but it is returning empty strings and other matches(e.g., ()). I realize I can delete afterwards but is there a direct way from split or ctRegex?

Re: Conditional Attributes

2020-02-20 Thread Dennis via Digitalmars-d-learn
On Tuesday, 18 February 2020 at 17:11:55 UTC, Marcel wrote: Say I have a struct where every member function can either be static or not depending on a template parameter. Is there a simple way to do this? The best I can think of is: ``` mixin template maybeStatic() { void foo() {

Re: Alternative to friend functions?

2020-02-20 Thread ShadoLight via Digitalmars-d-learn
On Thursday, 20 February 2020 at 08:02:48 UTC, Bienlein wrote: On Tuesday, 18 February 2020 at 12:43:22 UTC, Adnan wrote: What is the alternative to C++'s friend functions in D? module stable_matching; alias FemaleID = int; alias MaleID = int; class Person { string name; int id; } cl

Re: Alternative to friend functions?

2020-02-20 Thread Bienlein via Digitalmars-d-learn
On Tuesday, 18 February 2020 at 12:43:22 UTC, Adnan wrote: What is the alternative to C++'s friend functions in D? module stable_matching; alias FemaleID = int; alias MaleID = int; class Person { string name; int id; } class Male : Person { this(string name = "Unnamed Male") {