Re: How to get return type of current method?

2017-04-18 Thread Ali Çehreli via Digitalmars-d-learn
On 04/18/2017 06:40 PM, Meta wrote: > On Wednesday, 19 April 2017 at 00:22:14 UTC, Mike B Johnson wrote: >> On Tuesday, 18 April 2017 at 23:49:35 UTC, ketmar wrote: >>> Mike B Johnson wrote: >>> How can I get the return type of the current method without specifying the name or any comple

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-18 Thread Dmitry via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 13:48:57 UTC, Stanislav Blinov wrote: There's a much more concise workaround, both in code written and generated ;) import std.stdio; template func(string file = __FILE__, int line = __LINE__) { auto func(T...)(auto ref T args) { writeln("called fun

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-18 Thread Lewis via Digitalmars-d-learn
On Monday, 17 April 2017 at 14:23:50 UTC, Jonathan M Davis wrote: On Monday, April 17, 2017 13:45:18 Dmitry via Digitalmars-d-learn wrote: [...] Every time there's a new template instantiation, it's essentially copy-pasting the entire template. So, if you have the templated function [...]

Re: How to get return type of current method?

2017-04-18 Thread Meta via Digitalmars-d-learn
On Wednesday, 19 April 2017 at 00:22:14 UTC, Mike B Johnson wrote: On Tuesday, 18 April 2017 at 23:49:35 UTC, ketmar wrote: Mike B Johnson wrote: How can I get the return type of the current method without specifying the name or any complexity? Similar to typeof(this). typeof(return) Than

Re: How to get return type of current method?

2017-04-18 Thread Mike B Johnson via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 23:49:35 UTC, ketmar wrote: Mike B Johnson wrote: How can I get the return type of the current method without specifying the name or any complexity? Similar to typeof(this). typeof(return) Thanks, sweet and simple!

Re: How to get return type of current method?

2017-04-18 Thread ketmar via Digitalmars-d-learn
Mike B Johnson wrote: How can I get the return type of the current method without specifying the name or any complexity? Similar to typeof(this). typeof(return)

How to get return type of current method?

2017-04-18 Thread Mike B Johnson via Digitalmars-d-learn
How can I get the return type of the current method without specifying the name or any complexity? Similar to typeof(this).

Re: Out of data wiki

2017-04-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, April 18, 2017 19:54:26 Mike B Johnson via Digitalmars-d-learn wrote: > can this be updated to work? > > https://wiki.dlang.org/Timing_Code Wow, that's using some old stuff - stuff older than the wiki. Weird. It was probably ported from somewhere. The best thing to use now is core.ti

Out of data wiki

2017-04-18 Thread Mike B Johnson via Digitalmars-d-learn
can this be updated to work? https://wiki.dlang.org/Timing_Code

Re: Cleaning up Dub/Dmd builds

2017-04-18 Thread FreeSlave via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 17:58:32 UTC, WhatMeWorry wrote: On Tuesday, 18 April 2017 at 15:15:47 UTC, Stanislav Blinov wrote: On Tuesday, 18 April 2017 at 15:07:27 UTC, WhatMeWorry wrote: When I try to upload these files to my new repo, GitHub (rightfully so) complains that I have too many

Re: Cleaning up Dub/Dmd builds

2017-04-18 Thread WhatMeWorry via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 15:15:47 UTC, Stanislav Blinov wrote: On Tuesday, 18 April 2017 at 15:07:27 UTC, WhatMeWorry wrote: When I try to upload these files to my new repo, GitHub (rightfully so) complains that I have too many files. Since I'm using sdl and not json, can I safely delete a

Re: Cleaning up Dub/Dmd builds

2017-04-18 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 15:07:27 UTC, WhatMeWorry wrote: When I try to upload these files to my new repo, GitHub (rightfully so) complains that I have too many files. Since I'm using sdl and not json, can I safely delete all the files that pertain to json? Can I do this some way at the co

Cleaning up Dub/Dmd builds

2017-04-18 Thread WhatMeWorry via Digitalmars-d-learn
Just some basic questions regarding Dub projects with GitHub. I'm just getting my toes wet with GitHub so these might be pretty naive questions. I've got about 35 mini dub projects where each project holds an OpenGL tutorial. like so: 01_01_hello_window .dub build app

Re: The app hanging after reach 1750MB of RAM

2017-04-18 Thread Suliman via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 14:15:59 UTC, Stanislav Blinov wrote: On Tuesday, 18 April 2017 at 14:09:28 UTC, Stanislav Blinov wrote: foreach(row; result) { arr ~= row.toStruct(cargpspoint); } Sorry, this should be foreach(row; result) { row.toStruct(

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-18 Thread Solomon E via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 13:48:57 UTC, Stanislav Blinov wrote: On Tuesday, 18 April 2017 at 13:28:06 UTC, Solomon E wrote: I tried to produce an example of calling a function with variadic template arguments using special tokens __FILE__ and __LINE__. This compiles and runs, producing th

Re: The app hanging after reach 1750MB of RAM

2017-04-18 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 14:09:28 UTC, Stanislav Blinov wrote: foreach(row; result) { arr ~= row.toStruct(cargpspoint); } Sorry, this should be foreach(row; result) { row.toStruct(cargpspoint); arr ~= cargpspoint; }

Re: The app hanging after reach 1750MB of RAM

2017-04-18 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 13:28:57 UTC, Suliman wrote: Also I can't understand why app take so much memory? I checked array of structures size with this code: auto mymem = cargpspoints.length * typeof(cargpspoints[0]).sizeof; writeln(mymem); And it's print: 16963440 it's about 16MB...

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-18 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 13:28:06 UTC, Solomon E wrote: I tried to produce an example of calling a function with variadic template arguments using special tokens __FILE__ and __LINE__. This compiles and runs, producing the output shown, using the default gdc provided by Ubuntu 17.04. Thi

Re: The app hanging after reach 1750MB of RAM

2017-04-18 Thread Suliman via Digitalmars-d-learn
Also I can't understand why app take so much memory? I checked array of structures size with this code: auto mymem = cargpspoints.length * typeof(cargpspoints[0]).sizeof; writeln(mymem); And it's print: 16963440 it's about 16MB... What is takes all other memory?

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-18 Thread Solomon E via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 10:13:09 UTC, Jonathan M Davis wrote: On Monday, April 17, 2017 07:23:50 Jonathan M Davis via Digitalmars-d-learn wrote: So, if you're okay with explicitly instantiating your variadic function template instead of having the types inferred, then it can work, but othe

Re: make Pid constructor public

2017-04-18 Thread Domain via Digitalmars-d-learn
On Monday, 17 June 2013 at 22:38:47 UTC, Timothee Cour wrote: inside std.process it says: // Pids are only meant to be constructed inside this module, so we make the constructor private. However, this makes a number of useful functions from std.process useless unless the processes were created

The app hanging after reach 1750MB of RAM

2017-04-18 Thread Suliman via Digitalmars-d-learn
I am writing app that extract data from DB to array of structures. void getSingleTrackInfo() { foreach(item; getTablesGPSSensorList) { ResultRange result = mysqlconnection.query(sqlquery);

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 17, 2017 07:23:50 Jonathan M Davis via Digitalmars-d-learn wrote: > So, if you're okay with explicitly instantiating your variadic function > template instead of having the types inferred, then it can work, but > otherwise, no. Making it work would require a language enhancement

Re: if auto and method call

2017-04-18 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 09:05:10 UTC, Andrea Fontana wrote: On Tuesday, 18 April 2017 at 00:48:05 UTC, Jethro wrote: How to combine the need to localize a result for an if statement and have to call a method to get proper comparison: [...] which should simplify to if ((auto x = foo()).val

Re: if auto and method call

2017-04-18 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 00:48:05 UTC, Jethro wrote: How to combine the need to localize a result for an if statement and have to call a method to get proper comparison: [...] which should simplify to if ((auto x = foo()).valid()) { } but this code does not work. [...] for(auto x = foo

Re: Empty Result

2017-04-18 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2017-04-17 at 15:10 -0700, Ali Çehreli via Digitalmars-d-learn wrote: > alias RangeType = typeof(return); > return new RangeType(() {}); It appears the answer to my question is: return typeof(return)(); Thanks to Ali and T for setting on the right path. -- Russel. ===

Re: Stuck with DMD, and Unit-Threaded

2017-04-18 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2017-04-17 at 22:56 +, Atila Neves via Digitalmars-d-learn wrote: > […] > https://github.com/russel/ApproxGC/pull/2 > > Unfortunately the auto generated integration test main file  > doesn't quite work (feel free to file a bug on unit-threaded) so  > in that PR I disabled auto-generat