Re: An issue with setting delegates via templates

2011-11-02 Thread Christophe Travert
Andrej Mitrovic , dans le message (digitalmars.D.learn:30315), a écrit : > The new one: https://gist.github.com/1194497 > > I'll investigate this further then. OK, so there is indeed a filter to find a suitable delegate to load: @trusted T connect(T)(T handler) if(isHandler!(T, Types)); But onl

Re: Range of random numbers

2012-04-25 Thread Christophe Travert
"bearophile" , dans le message (digitalmars.D.learn:35148), a écrit : > Why don't you write a little benchmark to compare the performance > of the two versions? Because I'm interested in the code's meaning for the human reader, not the performance. I actually think : "map!(_=> uniform(a, b))(re

Re: toUTFz and WinAPI GetTextExtentPoint32W

2011-09-21 Thread Christophe Travert
> Here is a more readable and a bit faster version on dmd windows: > > size_t utfCount(string text) > { > size_t n = 0; > for (uint i=0; i n += ((text[i]>>6)^0b10)? 1: 0; > return n; > } Nice. It is better with gdc linux 64bits too. I wanted to avoid conditional expressi