On 09/02/2011 02:45 AM, bearophile wrote:
Timon Gehr:
according to TDPL p53., that fact is defined. (unary minus: -x == ~x+1)
Uh.
Bye,
bearophile
For unsigned integers it is clearly defined:
1000... = 0111... = 1000...
And according to TDPL p53: This manipulation does not raise
string[2][] results;
results ~= [foo, ];
results ~= [foobar, ];
size_t len;
foreach (res; results)
{
len = max(len, res[0].length);
}
That gives me '6'. I want to convert this to functional-style code
with reduce. I've tried:
len = reduce!(max!a[0].length)(results);
That's not it. Any
On 09/02/2011 07:11 PM, Andrej Mitrovic wrote:
string[2][] results;
results ~= [foo, ];
results ~= [foobar, ];
size_t len;
foreach (res; results)
{
len = max(len, res[0].length);
}
That gives me '6'. I want to convert this to functional-style code
with reduce. I've tried:
len =
On 9/2/11 7:11 PM, Andrej Mitrovic wrote:
string[2][] results;
results ~= [foo, ];
results ~= [foobar, ];
size_t len;
foreach (res; results)
{
len = max(len, res[0].length);
}
That gives me '6'. I want to convert this to functional-style code
with reduce. I've tried:
len =
On Fri, 02 Sep 2011 20:11:38 +0300, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
string[2][] results;
results ~= [foo, ];
results ~= [foobar, ];
size_t len;
foreach (res; results)
{
len = max(len, res[0].length);
}
That gives me '6'. I want to convert this to functional-style code
Thanks guys!
On 9/2/11 7:23 PM, David Nadlinger wrote:
[…] because reduce is really just another way to express
the above loop.
´
On second thought: The one-argument overload of it, that is. You can
also use differing types if you explicitly specify the starting value.
For your example you could do
On 9/2/11 8:05 PM, David Nadlinger wrote:
On 9/2/11 7:23 PM, David Nadlinger wrote:
[…] because reduce is really just another way to express
the above loop.
´
On second thought: The one-argument overload of it, that is. You can
also use differing types if you explicitly specify the starting
So I have this code right here (semi-pseudocode) inside a MenuBar widget:
void showMenu(index menuIndex) { }
void appendMenuButton()
{
static size_t menuIndex;
// create menu button, and then:
button.connect!(Signal.MouseClick) = { this.showMenu(menuIndex); };
menuIndex++;
}
Damn it looks like I've ran into some template bug as well.
With this:
@property void connect(Signal signal = Signal.MouseClick)(void
delegate() dg)
{
clickHandlers ~= dg;
}
and a call like this:
item.connect = { this.showMenu(0); };
this crashes with an access violation.
On 9/2/11 8:29 PM, Andrej Mitrovic wrote:
So how can I selectively copy the state of some variables at the site
of the definition of a delegate literal?
You can try introducing a new frame using a immediately executed
delegate literal:
button.connect!(Signal.MouseClick) = {
auto index =
On Fri, 02 Sep 2011 14:29:18 -0400, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
So I have this code right here (semi-pseudocode) inside a MenuBar
widget:
void showMenu(index menuIndex) { }
void appendMenuButton()
{
static size_t menuIndex;
// create menu button, and then:
On 9/2/11, Steven Schveighoffer schvei...@yahoo.com wrote:
Am I missing something, or is it this simple?
void appendMenuButton()
{
static size_t menuIndex;
auto frameIndex = menuIndex++;
button.connect!(Signal.MouseClick) = { this.showMenu(frameIndex); };
}
-Steve
Actually
On 09/02/2011 08:46 PM, Andrej Mitrovic wrote:
Damn it looks like I've ran into some template bug as well.
With this:
@property void connect(Signal signal = Signal.MouseClick)(void
delegate() dg)
{
clickHandlers ~= dg;
}
and a call like this:
item.connect = {
There's no question here but just an observation. I've recently had
this sort of bug:
class Foo {
void test() {
static size_t count;
// ..
count++;
}
}
void main() {
auto foo1 = new Foo;
foo1.test();
auto foo2 = new Foo;
foo2.test(); // affects the
On 9/3/11, Timon Gehr timon.g...@gmx.ch wrote:
What happens if you declare the function final?
Doesn't help. But it has to be virtual as every object needs to have
it's own set of delegates.
And wow, it seems to be random as well. If I do this:
@property void connect(Signal signal =
On 9/3/11, Andrej Mitrovic andrej.mitrov...@gmail.com wrote:
On 9/3/11, Timon Gehr timon.g...@gmx.ch wrote:
What happens if you declare the function final?
Doesn't help. But it has to be virtual as every object needs to have
it's own set of delegates.
Erm, sorry that reasoning was wrong. The
On 09/03/2011 01:13 AM, Andrej Mitrovic wrote:
On 9/3/11, Timon Gehrtimon.g...@gmx.ch wrote:
What happens if you declare the function final?
Doesn't help. But it has to be virtual as every object needs to have
it's own set of delegates.
So if I get you right, you made the templated version
Andrej Mitrovic andrej.mitrov...@gmail.com wrote in message
news:mailman.2651.1315000369.14074.digitalmars-d-le...@puremagic.com...
On 9/2/11, Steven Schveighoffer schvei...@yahoo.com wrote:
Am I missing something, or is it this simple?
void appendMenuButton()
{
static size_t menuIndex;
Am 26.08.2011 19:43, schrieb Christian Köstlin:
Hi guys,
i started the thread:
http://stackoverflow.com/questions/7202710/fastest-way-of-reading-bytes-in-d2
on stackoverflow, because i ran into kind of a problem.
i wanted to read data from a file (or even better from a stream, but
lets stay
20 matches
Mail list logo