Re: Version() for unittest OR debug?

2014-06-11 Thread Kagamin via Digitalmars-d-learn
debug version = DebugOrUnittest; else version(unittest)version = DebugOrUnittest; version(DebugOrUnittest) { static assert(false,DebugOrUnittest); }

Re: Splitting Ranges using Lambda Predicates

2014-06-11 Thread monarch_dodra via Digitalmars-d-learn
On Tuesday, 10 June 2014 at 22:31:37 UTC, Nordlöw wrote: Either way, it shouldn't be too hard to implement. Base it off splitter!pred, which is actually quite trivial. AFAIK, your What do you mean by basing it off splitter!pred - should I start with some existing splitter algorithm in Phobos

Re: Basic dynamic array question. Use of new versus no new.

2014-06-11 Thread monarch_dodra via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 05:46:07 UTC, Ali Çehreli wrote: On 06/10/2014 08:06 PM, Matt wrote: On Wednesday, 11 June 2014 at 02:30:01 UTC, WhatMeWorry wrote: int[] array; // initially empty array.length = 5; // now has 5 elements while in Mr. Alexandrescu's book, it says To create a

Re: Version() for unittest OR debug?

2014-06-11 Thread Juanjo Alvarez via Digitalmars-d-learn
On Tuesday, 10 June 2014 at 14:06:58 UTC, bearophile wrote: Juanjo Alvarez: Probably I pretty simple question, how could I mark some code to be compiled when in debug OR unittest mode? (or both, ||) At first I tough I could do: version(unittest, debug) {} You can define a enum boolean

Re: Source File and Position of User Defined Type

2014-06-11 Thread Matt via Digitalmars-d-learn
On Tuesday, 10 June 2014 at 20:58:41 UTC, Nordlöw wrote: Is there a way to, programatically (trait), lookup the source file and position of a user defined type either dynamically or, even better, statically? I don't know about the source file, per se, but std.traits has the

Re: crt1.o: could not read symbols: Bad value

2014-06-11 Thread FreeSlave via Digitalmars-d-learn
It seems like you're trying to compile 64-bit code when you are on 32-bit system and you have 32-bit libphobos.

Re: crt1.o: could not read symbols: Bad value

2014-06-11 Thread FreeSlave via Digitalmars-d-learn
I conclude that because I have similar errors when trying to build 64-bit library on 32-bit system. /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(format_712_5b3.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC

Re: Basic dynamic array question. Use of new versus no new.

2014-06-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Wed, 11 Jun 2014 02:30:00 + WhatMeWorry via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: In Mr. Cehreli's book it says Additionally, the length of dynamic arrays can be changed by assigning a value to this property: int[] array; // initially empty array.length = 5;

passing predicates to lowerBound, or alternatively, how lazy is map?

2014-06-11 Thread Andrew Brown via Digitalmars-d-learn
Hi there, The problem this question is about is now solved, by writing my own binary search algorithm, but I'd like to ask it anyway as I think I could learn a lot from the answers. The problem was, given an array of numbers, double[] numbers, and an ordering from makeIndex size_t[] order,

Re: passing predicates to lowerBound, or alternatively, how lazy is map?

2014-06-11 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 11:22:08 UTC, Andrew Brown wrote: Hi there, The problem this question is about is now solved, by writing my own binary search algorithm, but I'd like to ask it anyway as I think I could learn a lot from the answers. The problem was, given an array of numbers,

Re: passing predicates to lowerBound, or alternatively, how lazy is map?

2014-06-11 Thread Andrew Brown via Digitalmars-d-learn
My question about this is how lazy is map? Will it work on every value of order and then pass it to lowerBound, or could it work to evaluate only those values asked by lowerBound? I guess probably not, but could a function be composed that worked in this way? Thank you very much Andrew

Re: Splitting Ranges using Lambda Predicates

2014-06-11 Thread Artur Skawina via Digitalmars-d-learn
On 06/11/14 00:31, Nordlöw via Digitalmars-d-learn wrote: Either way, it shouldn't be too hard to implement. Base it off splitter!pred, which is actually quite trivial. AFAIK, your What do you mean by basing it off splitter!pred - should I start with some existing splitter algorithm in

Re: passing predicates to lowerBound, or alternatively, how lazy is map?

2014-06-11 Thread Andrew Brown via Digitalmars-d-learn
map is fully lazy. However, if you've already got the sorted indices in `order`, I would do this: auto numLessThanN = numbers.indexed(order).countUntil!((x) = x = N)(); That indexed command is perfect though, does the trick, thank you very much.

Re: Splitting Ranges using Lambda Predicates

2014-06-11 Thread monarch_dodra via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 11:42:42 UTC, Artur Skawina via Digitalmars-d-learn wrote: On 06/11/14 00:31, Nordlöw via Digitalmars-d-learn wrote: Either way, it shouldn't be too hard to implement. Base it off splitter!pred, which is actually quite trivial. AFAIK, your What do you mean by

Re: problem with Access Violation, and I'm not sure where

2014-06-11 Thread Mike Parker via Digitalmars-d-learn
On 6/11/2014 2:14 PM, Matt wrote: window = SDL_CreateWindow (cfg[window][caption].str.ptr, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_SHOWN); I'm curious -- does cfg[][].str ensure that the string is null terminated? Because if it doesn't, you've got

Re: passing predicates to lowerBound, or alternatively, how lazy is map?

2014-06-11 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 11:50:36 UTC, Andrew Brown wrote: map is fully lazy. However, if you've already got the sorted indices in `order`, I would do this: auto numLessThanN = numbers.indexed(order).countUntil!((x) = x = N)(); That indexed command is perfect though, does the trick,

Re: passing predicates to lowerBound, or alternatively, how lazy is map?

2014-06-11 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 11:38:07 UTC, Andrew Brown wrote: My question about this is how lazy is map? Will it work on every value of order and then pass it to lowerBound, or could it work to evaluate only those values asked by lowerBound? I guess probably not, but could a function be

Re: passing predicates to lowerBound, or alternatively, how lazy is map?

2014-06-11 Thread Andrew Brown via Digitalmars-d-learn
You are correct. assumeSorted and lowerBound will provide better time complexity than countUntil I'm sorry, one final question because I think I'm close to understanding. Map produces a forward range (lazily) but not a random access range? Therefore, lowerBound will move along this range

Re: passing predicates to lowerBound, or alternatively, how lazy is map?

2014-06-11 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 13:20:37 UTC, Andrew Brown wrote: You are correct. assumeSorted and lowerBound will provide better time complexity than countUntil I'm sorry, one final question because I think I'm close to understanding. Map produces a forward range (lazily) but not a random

Re: passing predicates to lowerBound, or alternatively, how lazy is map?

2014-06-11 Thread Andrew Brown via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 13:25:03 UTC, John Colvin wrote: On Wednesday, 11 June 2014 at 13:20:37 UTC, Andrew Brown wrote: You are correct. assumeSorted and lowerBound will provide better time complexity than countUntil I'm sorry, one final question because I think I'm close to

Re: Splitting Ranges using Lambda Predicates

2014-06-11 Thread Artur Skawina via Digitalmars-d-learn
On 06/11/14 14:40, monarch_dodra via Digitalmars-d-learn wrote: For example, you should avoid countUntil and takeExactly when dealing with strings, since these are not O(1) operations, and don't actually return string slices. EG: string s = someGGGreatVariableName.slicer().front; Error:

Basics of calling C from D

2014-06-11 Thread belkin via Digitalmars-d-learn
Example: I have this C function that is compiled into a library //File: factorial.h int factorial(int n); //File: factorial.c #include factorial.h int factorial(int n) { if(n!=1) return n*factorial(n-1); } Question: How do I use it from D?

Re: Basics of calling C from D

2014-06-11 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 13:52:09 UTC, belkin wrote: Example: I have this C function that is compiled into a library //File: factorial.h int factorial(int n); //File: factorial.c #include factorial.h int factorial(int n) { if(n!=1) return n*factorial(n-1); } Question: How do I

Re: Basics of calling C from D

2014-06-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 13:52:09 UTC, belkin wrote: Question: How do I use it from D? Write the prototype in your D file with extern(C): extern(C) int factorial(int n); then just call the function normally in D. Make sure you include all the C object files when you compile the D

Re: Splitting Ranges using Lambda Predicates

2014-06-11 Thread Artur Skawina via Digitalmars-d-learn
On 06/11/14 15:44, Artur Skawina wrote: If, instead, you create a string-specific 'countUntil' that returns a type that holds both the byte and code-point counts and implicitly converts to the latter, then you can have a 'takeExactly' overload that uses the extra info to avoid the unnecessary

Re: Splitting Ranges using Lambda Predicates

2014-06-11 Thread monarch_dodra via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 13:44:25 UTC, Artur Skawina via Digitalmars-d-learn wrote: There is a reason why I never use D's std lib. artur Well, (IMO) it's a problem with no real solution. But for what it's worth, most (if not all) of the algorithms in the standard lib know how to handle

Re: Basics of calling C from D

2014-06-11 Thread simendsjo via Digitalmars-d-learn
On 06/11/2014 03:54 PM, Adam D. Ruppe wrote: On Wednesday, 11 June 2014 at 13:52:09 UTC, belkin wrote: Question: How do I use it from D? Write the prototype in your D file with extern(C): extern(C) int factorial(int n); then just call the function normally in D. Make sure you include all

Re: Basics of calling C from D

2014-06-11 Thread belkin via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 14:02:08 UTC, John Colvin wrote: On Wednesday, 11 June 2014 at 13:52:09 UTC, belkin wrote: Example: I have this C function that is compiled into a library //File: factorial.h int factorial(int n); //File: factorial.c #include factorial.h int factorial(int n) {

Re: Basics of calling C from D

2014-06-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 14:11:04 UTC, simendsjo wrote: I believe the correct answer should be Buy my book!. ah, of course! I should just make a .sig file lol http://www.packtpub.com/discover-advantages-of-programming-in-d-cookbook/book chapter 4 talks about this kind of thing :P

Re: passing predicates to lowerBound, or alternatively, how lazy is map?

2014-06-11 Thread Andrew Brown via Digitalmars-d-learn
So I was hoping for a learning experience, and I got it. With a little playing around, looking at phobos, and TDPL, I think I've figured out how lowerBound gets its predicate. It learns it from assumeSorted. So I can do this: order.assumeSorted!((a, b) = number[a] number[b])

Re: Basics of calling C from D

2014-06-11 Thread belkin via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 14:22:51 UTC, Adam D. Ruppe wrote: On Wednesday, 11 June 2014 at 14:11:04 UTC, simendsjo wrote: I believe the correct answer should be Buy my book!. ah, of course! I should just make a .sig file lol

Re: Basics of calling C from D

2014-06-11 Thread simendsjo via Digitalmars-d-learn
On 06/11/2014 04:22 PM, Adam D. Ruppe wrote: On Wednesday, 11 June 2014 at 14:11:04 UTC, simendsjo wrote: I believe the correct answer should be Buy my book!. ah, of course! I should just make a .sig file lol http://www.packtpub.com/discover-advantages-of-programming-in-d-cookbook/book

Re: Basics of calling C from D

2014-06-11 Thread Colin via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 14:28:49 UTC, belkin wrote: On Wednesday, 11 June 2014 at 14:02:08 UTC, John Colvin wrote: On Wednesday, 11 June 2014 at 13:52:09 UTC, belkin wrote: Example: I have this C function that is compiled into a library //File: factorial.h int factorial(int n);

Re: Basics of calling C from D

2014-06-11 Thread Colin via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 15:14:19 UTC, Colin wrote: On Wednesday, 11 June 2014 at 14:28:49 UTC, belkin wrote: On Wednesday, 11 June 2014 at 14:02:08 UTC, John Colvin wrote: On Wednesday, 11 June 2014 at 13:52:09 UTC, belkin wrote: Example: I have this C function that is compiled into a

Re: Basics of calling C from D

2014-06-11 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 14:28:49 UTC, belkin wrote: On Wednesday, 11 June 2014 at 14:02:08 UTC, John Colvin wrote: On Wednesday, 11 June 2014 at 13:52:09 UTC, belkin wrote: Example: I have this C function that is compiled into a library //File: factorial.h int factorial(int n);

Re: Basic dynamic array question. Use of new versus no new.

2014-06-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tue, 10 Jun 2014 23:28:16 -0400, Kapps opantm2+s...@gmail.com wrote: On Wednesday, 11 June 2014 at 02:30:01 UTC, WhatMeWorry wrote: In Mr. Cehreli's book it says Additionally, the length of dynamic arrays can be changed by assigning a value to this property: int[] array; // initially

Node.js async/threads and shared in D

2014-06-11 Thread George Sapkin via Digitalmars-d-learn
I have a Node.js module written in D and exposed through C++ interface. I'd like to implement a proper async API which is pretty straightforward using libuv in the C++ glue part. On the D side I have a data structure that's build once and then queried from Node (possibly torn down and rebuild

Re: Decimal type documentation

2014-06-11 Thread Tim via Digitalmars-d-learn
On Tuesday, 10 June 2014 at 15:52:29 UTC, Poyeyo wrote: Hello, has anyone used this https://github.com/andersonpd/decimal implementation? I'm learning D and want to know where to start for the decimal (or bigfloat) stuff. The goal is to be able to read and write some data from a SQL DB

Re: crt1.o: could not read symbols: Bad value

2014-06-11 Thread Tim via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 10:09:50 UTC, FreeSlave wrote: I conclude that because I have similar errors when trying to build 64-bit library on 32-bit system. /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(format_712_5b3.o): relocation R_X86_64_32 against `.rodata' can not be used

Re: crt1.o: could not read symbols: Bad value

2014-06-11 Thread Tim via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 17:11:51 UTC, Tim wrote: On Wednesday, 11 June 2014 at 10:09:50 UTC, FreeSlave wrote: I conclude that because I have similar errors when trying to build 64-bit library on 32-bit system. /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(format_712_5b3.o):

Multiple alias this failed workaround...obscure error message

2014-06-11 Thread matovitch via Digitalmars-d-learn
I was looking for a workaround to multiple alias this (or opImplicitCast) the following trick doesn't work (why shouldn't it ?). The error message is quite obscure to me. import std.stdio; class A(Derived) { alias cast(ref Derived)(this).x this; } class B : A!B { float x; } class C

escape string into a C style string litteral (pasteable in C code)

2014-06-11 Thread Timothee Cour via Digitalmars-d-learn
Is there an existing way to do it or do I have to roll my own? unittest{ assert(escapeC(`abc\ndef`~\n) == `a\bc\\ndef\n`); } Likewise with escapeD (pastable in D code), which would return something like: `r...` for more readability

Re: Splitting Ranges using Lambda Predicates

2014-06-11 Thread Artur Skawina via Digitalmars-d-learn
On 06/11/14 16:05, monarch_dodra via Digitalmars-d-learn wrote: Well, (IMO) it's a problem with no real solution. But for what it's worth, most (if not all) of the algorithms in the standard lib know how to handle strings efficiently and correctly (split, find, etc...). Things only start

Working on a library: request for code review

2014-06-11 Thread Mike via Digitalmars-d-learn
Hello. I am new to D and I must admit I really like the language. In my opinion it takes the best from C++ and, say, Python and combines it really elegantly. Great work! I am currently working on my first library in D - related to TARGA image format. Here's the link to the repo:

Re: Source File and Position of User Defined Type

2014-06-11 Thread Kapps via Digitalmars-d-learn
On Tuesday, 10 June 2014 at 20:58:41 UTC, Nordlöw wrote: Is there a way to, programatically (trait), lookup the source file and position of a user defined type either dynamically or, even better, statically? I don't believe this is possible. Perhaps you would be able to generate the .json

Re: Multiple alias this failed workaround...obscure error message

2014-06-11 Thread Jonathan M Davis via Digitalmars-d-learn
Sent: Wednesday, June 11, 2014 at 8:07 PM From: matovitch via Digitalmars-d-learn digitalmars-d-learn@puremagic.com To: digitalmars-d-learn@puremagic.com Subject: Multiple alias this failed workaround...obscure error message I was looking for a workaround to multiple alias this (or

Re: Source File and Position of User Defined Type

2014-06-11 Thread Nordlöw
I don't believe this is possible. Perhaps you would be able to How about adding __traits(sourceFile, T) __traits(sourceLine, T) __traits(sourceColumn, T) to DMD? T of course must be a user-defined type.

Cannot understand deprecation message recently added to Phobos

2014-06-11 Thread Nordlöw
Can somebody explain the meaning of split in the error message Deprecation: function core.time.Duration.weeks is deprecated - Please use split instead. weeks was too frequently confused for total!weeks. given by function shortDurationString() at

Re: Multiple alias this failed workaround...obscure error message

2014-06-11 Thread via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 18:07:44 UTC, matovitch wrote: source/app.d(5): Error: basic type expected, not cast source/app.d(5): Error: no identifier for declarator int source/app.d(5): Error: semicolon expected to close alias declaration source/app.d(5): Error: Declaration expected, not

Re: Cannot understand deprecation message recently added to Phobos

2014-06-11 Thread Kapps via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 20:59:25 UTC, Nordlöw wrote: Can somebody explain the meaning of split in the error message Deprecation: function core.time.Duration.weeks is deprecated - Please use split instead. weeks was too frequently confused for total!weeks. given by function

Re: Cannot understand deprecation message recently added to Phobos

2014-06-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On Wed, 11 Jun 2014 16:59:24 -0400, Nordlöw per.nord...@gmail.com wrote: Can somebody explain the meaning of split in the error message Deprecation: function core.time.Duration.weeks is deprecated - Please use split instead. weeks was too frequently confused for total!weeks. given by

Re: Cannot understand deprecation message recently added to Phobos

2014-06-11 Thread Nordlöw
On Wednesday, 11 June 2014 at 21:06:42 UTC, Kapps wrote: On Wednesday, 11 June 2014 at 20:59:25 UTC, Nordlöw wrote: Can somebody explain the meaning of split in the error message Deprecation: function core.time.Duration.weeks is deprecated - Please use split instead. weeks was too frequently

Re: Cannot understand deprecation message recently added to Phobos

2014-06-11 Thread Nordlöw
You can safely change your code to use total!weeks instead. Ok. Thx

Re: Cannot understand deprecation message recently added to Phobos

2014-06-11 Thread Nordlöw
https://github.com/D-Programming-Language/druntime/pull/825 I updated https://github.com/nordlow/justd/blob/master/pprint.d with two versions of shortDurationString(). DMD picks the right one using static if (__VERSION__ = 2066L) // new else // old I hope I it right this time.

Re: Basics of calling C from D

2014-06-11 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On 11/06/14 16:22, Adam D. Ruppe via Digitalmars-d-learn wrote: On Wednesday, 11 June 2014 at 14:11:04 UTC, simendsjo wrote: I believe the correct answer should be Buy my book!. ah, of course! I should just make a .sig file lol

modulo Strangeness?

2014-06-11 Thread Taylor Hillegeist via Digitalmars-d-learn
I have a simpleish bit of code here that always seems to give me an error, and i can't figure out quite why. If I have a constant 43 in the modulo if breaks. however if i use points.length it seems to be ok? import std.stdio; void main(){ int points[43] = [0, 1153, 1905, 1996, 1392, 305,

Re: modulo Strangeness?

2014-06-11 Thread Taylor Hillegeist via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 22:32:45 UTC, Taylor Hillegeist wrote: I have a simpleish bit of code here that always seems to give me an error, and i can't figure out quite why. If I have a constant 43 in the modulo if breaks. however if i use points.length it seems to be ok? import

Re: modulo Strangeness?

2014-06-11 Thread Taylor Hillegeist via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 22:35:39 UTC, Taylor Hillegeist wrote: On Wednesday, 11 June 2014 at 22:32:45 UTC, Taylor Hillegeist wrote: I have a simpleish bit of code here that always seems to give me an error, and i can't figure out quite why. If I have a constant 43 in the modulo if

Re: modulo Strangeness?

2014-06-11 Thread Taylor Hillegeist via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 22:38:02 UTC, Taylor Hillegeist wrote: On Wednesday, 11 June 2014 at 22:35:39 UTC, Taylor Hillegeist wrote: On Wednesday, 11 June 2014 at 22:32:45 UTC, Taylor Hillegeist wrote: I have a simpleish bit of code here that always seems to give me an error, and i can't

Re: modulo Strangeness?

2014-06-11 Thread safety0ff via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 22:32:45 UTC, Taylor Hillegeist wrote: I have a simpleish bit of code here that always seems to give me an error, and i can't figure out quite why. modulo takes the sign of the dividend: http://en.wikipedia.org/wiki/Modulo_operation#Common_pitfalls It works with

Re: modulo Strangeness?

2014-06-11 Thread Adam D. Ruppe via Digitalmars-d-learn
modulo of a negative number can give some surprising results. A negative index in that array would cause it to throw a range error, so my guess is that's what you're getting. If you do %array.length though it becomes an unsigned math and thus will never be negative, explaining the different

Re: Multiple alias this failed workaround...obscure error message

2014-06-11 Thread matovitch via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 20:53:21 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: I don't believe that it's legal to use a cast in an alias declaration, and that's certainly what the error seems to be indicating. Also, using ref in a cast is definitely illegal regardless of where

Re: Multiple alias this failed workaround...obscure error message

2014-06-11 Thread matovitch via Digitalmars-d-learn
If I quote de documentation : Any casting of a class reference to a derived class reference is done with a runtime check to make sure it really is a downcast. null is the result if it isn't. Note: This is equivalent to the behavior of the dynamic_cast operator in C++. I explicitly kept

Re: Basics of calling C from D

2014-06-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 14:45:22 UTC, simendsjo wrote: I must say I really like your writing-style as well as the down-to-earth and precise and concise presentation of the material. So kudos to you! thanks, don't forget to tell that to amazon review readers too :P Really looking

Re: Working on a library: request for code review

2014-06-11 Thread cal via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 18:29:27 UTC, Mike wrote: Hello. Here's the link to the repo: http://bit.ly/1mIuGhv Hi, sorry didn't read through your code yet, but while ago I wrote some encoders/decoders for jpeg and png (https://github.com/callumenator/imaged, haven't compiled it in a

Re: Multiple alias this failed workaround...obscure error message

2014-06-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Wed, 11 Jun 2014 23:01:31 + matovitch via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: About alias working with identifier but not with (runtime) expression. Alias should work with compile time expression like map!(x=2*x) right ? So a static cast should work isn't it ?

HeadUnshared in core.atomic

2014-06-11 Thread Mike Franklin via Digitalmars-d-learn
Hello, I was recently exposed to this template in core.atomic: private { template HeadUnshared(T) { static if( is( T U : shared(U*) ) ) alias shared(U)* HeadUnshared; else alias T HeadUnshared; } } Could someone please explain/elaborate on