https://dpaste.dzfl.pl/cd605899d050
why this code cannot convert to foreach (over Structs and Classes
with Ranges).
auto h = new BinaryHeap!(int[])(new int[0]);
typeof(h).stringof.writeln;
static assert(isInputRange!(typeof(h)));
h.insert(3);
h.insert(1);
h.insert(2);
On Saturday, 30 September 2017 at 09:27:23 UTC, Shigeki Karita
wrote:
https://dpaste.dzfl.pl/cd605899d050
why this code cannot convert to foreach (over Structs and
Classes with Ranges).
auto h = new BinaryHeap!(int[])(new int[0]);
typeof(h).stringof.writeln;
static
On Saturday, 30 September 2017 at 08:49:14 UTC, user1234 wrote:
On Saturday, 30 September 2017 at 06:15:41 UTC, Nicholas Wilson
wrote:
No "initialising onError", the static this is not even being
run!
I'm using LDC master.
See also https://github.com/libmir/dcompute/issues/32
LDC 1.4, DMD
On 2017-09-30 08:56, Tony wrote:
The documentation says:
--
This module contains bindings to selected types and functions from the
standard C header . Note that this is not automatically
generated, and may omit some types/functions from the
On 30-09-17 03:27, Tony wrote:
One thing I picked up from SCons is creating dynamic object files with a
.os extension and static object files with the standard .o extension.
That way they can be compiled in the same directory in the same build
step. But dmd rejects the files that are named
On 9/29/17 11:39 PM, bitwise wrote:
As far as I can tell, this code should compile:
class B { int a; }
class D1 : B { int b; }
class D2 : D1 { int c; }
template TupleOf(Classes...)
{
static if(Classes.length > 1)
alias TupleOf = AliasSeq!(Classes[0].tupleof,
On Saturday, 30 September 2017 at 12:07:21 UTC, Nicholas Wilson
wrote:
Hmm. Everything except for the main function was in a different
module, I dont see why that would cause it to not be run, but
then bugs have a tendency to do strange things like that. I'll
have to dust mite DCompute and see
On Saturday, 30 September 2017 at 07:41:21 UTC, Igor wrote:
On Friday, 29 September 2017 at 22:13:01 UTC, Jon Degenhardt
wrote:
Have there been any investigations into using region-based
memory management (aka memory arenas) in D, possibly in
conjunction with GC allocated memory?
Sounds like
writeln( "a.b.c".splitter('.').dropBack(1) ); //compiles ok
writeln( "a.b.c".splitter(".").dropBack(1) );
//error:
Error: template std.range.dropBack cannot deduce function from
argument types !()(Result, int), candidates are:
(...)
Hm.. can someone explain whats going on?
Hello all
only for learning purposes and my interest for deeper network
programming. I wanted to write a program and filter the entire
traffic in my network. I have a server and various computers in
my network, but I dont know, as I in D the promiscous mode for
sockets can switch on.
Is
On Saturday, 30 September 2017 at 12:42:17 UTC, Steven
Schveighoffer wrote:
I think the problem may be that derived classes' tupleof has
some of the same variables as the base class?
I agree it should work, but I think if it did work, it may not
be what you want. You would see a lot of
On Saturday, 30 September 2017 at 10:09:43 UTC, Mike Wey wrote:
On 30-09-17 03:27, Tony wrote:
One thing I picked up from SCons is creating dynamic object
files with a .os extension and static object files with the
standard .o extension. That way they can be compiled in the
same directory in
On Friday, 29 September 2017 at 22:13:01 UTC, Jon Degenhardt
wrote:
Have there been any investigations into using region-based
memory management (aka memory arenas) in D, possibly in
conjunction with GC allocated memory? This would be a very
speculative idea, but it'd be interesting to know if
struct MyType
{
void* ptr;
static struct Info
{
@(42) int foo;
}
// Should be generated by the mixin below
@property int foo()
{
int ret;
getMyTypeInfo(ptr,42,int.sizeof,);
return ret;
}
mixin generateInfo!getMyTypeInfo;
}
On Friday, 29 September 2017 at 22:15:44 UTC, Mengu wrote:
On Friday, 29 September 2017 at 02:34:08 UTC, DreadKyller wrote:
[...]
+1 for forum issue.
+1 please...
I want a module level initialised delegate. if I try
module foo;
enum Status
{
success,
}
class StatusException : Exception
{
Status s;
// usual exception constructors
}
void delegate(Status) onError = (Status s) { throw new
StatusException(s);};
I get a error like cannot
On Saturday, 30 September 2017 at 07:45:27 UTC, Jacob Carlborg
wrote:
On 2017-09-30 08:56, Tony wrote:
The documentation says:
--
This module contains bindings to selected types and functions
from the
standard C header . Note that this is
On Saturday, 30 September 2017 at 08:20:44 UTC, Nicholas Wilson
wrote:
struct MyType
{
void* ptr;
static struct Info
{
@(42) int foo;
}
// Should be generated by the mixin below
@property int foo()
{
int ret;
On Saturday, 30 September 2017 at 06:15:41 UTC, Nicholas Wilson
wrote:
No "initialising onError", the static this is not even being
run!
I'm using LDC master.
See also https://github.com/libmir/dcompute/issues/32
LDC 1.4, DMD 2.076, DMD ~master and finally GDC all give the
expected result
The documentation says:
--
This module contains bindings to selected types and functions
from the standard C header . Note that this is not
automatically generated, and may omit some types/functions from
the original C header.
I have to display images with a few controls: alpha channel,
rotation, scaling, cropping. Generally it should be png but I
want to be able to handle many images. The images will be memory
based(I'll load the file in to memory then) and will be displayed
in a drawing area.
Any ideas how to go
In order to know where to split, it really has to do it from
the front. If it starts from the back, you won't necessarily
split in the same places as when iterating from the front, and
that would violate how bidirectional ranges are supposed to
work (the elements should be the same - just in
struct MyType
{
void* raw;
static struct Info
{
@(42) int foo;
}
mixin generateGetInfo!MyTypeGetInfo;
}
extern(C) void MyTypeGetInfo(void*,int,size_t,void*size_t*);
mixin template generateGetInfo(alias func)
{
foreach(field; typeof(this).Info.tupleof)
{
On Saturday, September 30, 2017 20:18:25 Jon Degenhardt via Digitalmars-d-
learn wrote:
> On Saturday, 30 September 2017 at 17:17:17 UTC, SrMordred wrote:
> > writeln( "a.b.c".splitter('.').dropBack(1) ); //compiles ok
> > writeln( "a.b.c".splitter(".").dropBack(1) );
> >
> > //error:
> > Error:
On Sunday, 1 October 2017 at 01:05:56 UTC, Nicholas Wilson wrote:
struct MyType
{
void* raw;
static struct Info
{
@(42) int foo;
}
mixin generateGetInfo!MyTypeGetInfo;
}
extern(C) void MyTypeGetInfo(void*,int,size_t,void*size_t*);
mixin template generateGetInfo(alias
On Sunday, October 01, 2017 00:56:23 SrMordred via Digitalmars-d-learn
wrote:
> > In order to know where to split, it really has to do it from
> > the front. If it starts from the back, you won't necessarily
> > split in the same places as when iterating from the front, and
> > that would violate
On Sunday, October 01, 2017 02:07:26 Nicholas Wilson via Digitalmars-d-learn
wrote:
> On Sunday, 1 October 2017 at 01:05:56 UTC, Nicholas Wilson wrote:
> > struct MyType
> > {
> >
> > void* raw;
> > static struct Info
> > {
> >
> > @(42) int foo;
> >
> > }
> > mixin
On Saturday, 30 September 2017 at 17:17:17 UTC, SrMordred wrote:
writeln( "a.b.c".splitter('.').dropBack(1) ); //compiles ok
writeln( "a.b.c".splitter(".").dropBack(1) );
//error:
Error: template std.range.dropBack cannot deduce function from
argument types !()(Result, int), candidates are:
On Saturday, 30 September 2017 at 18:21:11 UTC, Jon Degenhardt
wrote:
On Saturday, 30 September 2017 at 17:17:17 UTC, SrMordred wrote:
[...]
It's easy to overlook, but documentation for splitter starts
out:
Lazily splits a range using an element as a separator.
An element of a string
For "a.b.c"splitter(x), Range r is a string, r.front is a
char. The template can only be instantiated if the predicate
function is valid. The predicate function is "a == b". Since
r.front is a char, then s must be a type that can be compared
with '=='. A string and char cannot be compared with
On Saturday, 30 September 2017 at 19:26:14 UTC, SrMordred wrote:
For "a.b.c"splitter(x), Range r is a string, r.front is a
char. The template can only be instantiated if the predicate
function is valid. The predicate function is "a == b". Since
r.front is a char, then s must be a type that can
On Saturday, 30 September 2017 at 17:17:17 UTC, SrMordred wrote:
writeln( "a.b.c".splitter('.').dropBack(1) ); //compiles ok
writeln( "a.b.c".splitter(".").dropBack(1) );
//error:
Error: template std.range.dropBack cannot deduce function from
argument types !()(Result, int), candidates are:
Hello, can I make AliasSeq not inside template function, for
example I want add function called `registerComponent` which will
add the components classes to list and based on this generated
list I want add additional fields inside `ComponentsManager`.
Example:
Registering components:
struct
On Sunday, October 01, 2017 03:11:15 Nicholas Wilson via Digitalmars-d-learn
wrote:
> On Sunday, 1 October 2017 at 02:29:57 UTC, Jonathan M Davis wrote:
> > I would have thought that it would be pretty straightforward to
> > just write a recursive, eponymous template to solve the problem
> > and
Oh, struct/class semantics really confuses me!
On Sunday, 1 October 2017 at 02:29:57 UTC, Jonathan M Davis wrote:
I would have thought that it would be pretty straightforward to
just write a recursive, eponymous template to solve the problem
and have it recursively build a single string to mix in for
everything.
In general though,
36 matches
Mail list logo