how to debug memory errors

2016-11-07 Thread Øivind via Digitalmars-d-learn
debugging and resolving these? -Øivind

Re: Variant and immutable struct

2016-08-21 Thread Øivind via Digitalmars-d-learn
On Sunday, 10 January 2016 at 17:50:44 UTC, Vlad Leberstein wrote: As I'm not very good at D, I would like to get some feedback about this solutions' viability. AFAIU memcpy-ing struct here is safe because all target arguments ever passed to tryPutting are internal to implementation(and

Re: static init of associative array of enums not working.. why?

2016-02-26 Thread Øivind via Digitalmars-d-learn
On Saturday, 27 February 2016 at 04:35:41 UTC, Adam D. Ruppe wrote: It just isn't implemented in the compiler. Instead, you can declare it outside and set it in a static module constructor: That was quick! Thank you. Should I file a ticket for this?

static init of associative array of enums not working.. why?

2016-02-26 Thread Øivind via Digitalmars-d-learn
Shouldn't this work? According to "Static Initialization of AAs" on this page, it should: https://dlang.org/spec/hash-map.html enum DevicePropDataType { dString, dDateTime } enum DevicePropValType { property, miscDate } immutable DevicePropDataType[DevicePropValType] propDType = [

version in enum

2016-01-09 Thread Øivind via Digitalmars-d-learn
Hi, Why doesn't this work? Seems like it should: enum { A = 1, version(xx) { B = 2 } } void main() { } Compilation output: /d732/f174.d(5): Error: basic type expected, not version /d732/f174.d(5): Error: no identifier for declarator int

change value of item in BinaryHeap

2014-04-27 Thread Øivind
I am trying to figure out how to change the value of an element in a BinaryHeap (from std.container) and have it repositioned such that the heap is still valid. Can anyone help me with this? The approach I would have taken (I think) is to remove the elements that get new values from the

Interfaces based on TypeTuple?

2013-12-25 Thread Øivind
How can I achieve something like the following? I want to create a class B that has all the interfaces of the class passed as a template parameter. import std.trats; interface I0 {} interface I1 {} class A : I0, I1 {} class B!C : InterfacesTuple!C {} void main() { B!A a; }

Re: Interfaces based on TypeTuple?

2013-12-25 Thread Øivind
On Wednesday, 25 December 2013 at 07:45:37 UTC, Øivind wrote: How can I achieve something like the following? I want to create a class B that has all the interfaces of the class passed as a template parameter. import std.trats; interface I0 {} interface I1 {} class A : I0, I1 {} class B!C

Re: Interfaces based on TypeTuple?

2013-12-25 Thread Øivind
On Wednesday, 25 December 2013 at 07:49:35 UTC, Jakob Ovrum wrote: On Wednesday, 25 December 2013 at 07:45:37 UTC, Øivind wrote: class B!C : InterfacesTuple!C {} You probably meant: class B(C) : InterfacesTuple!C {} Yes, stupid typo. Thanks for the quick answer. Awesome that this works :)

Re: static init cycle detection problem

2012-09-20 Thread Øivind
On Thursday, 20 September 2012 at 00:23:33 UTC, Jonathan M Davis wrote: On Wednesday, September 19, 2012 22:25:46 Øivind wrote: I am struggeling to get around the cycle detection kicking in when I have static init in modules that depend on eachother. I have seen some threads on 'fixes

access enclosing type from shared static this()

2012-09-19 Thread Øivind
!().getName(this M) cannot deduce template function from argument types !()() If not possible, just getting the name of the enclosing struct would help a lot! -Øivind

Re: access enclosing type from shared static this()

2012-09-19 Thread Øivind
Thanks a lot both of you. The code below worked. I did not expect 'this' to be available in the static function, but of course the type of 'this' is available. mixin template MsgMixin(T ...) { shared static this() { import std.stdio; writeln(register ~

static init cycle detection problem

2012-09-19 Thread Øivind
it be possible in e.g. main() to get a list of all compiled-in modules, and then iterate over them and call an init function where it exists? As long as there is a way to list the name of the modules at compile-time, this should be pretty easy..? -Øivind

Re: static init cycle detection problem

2012-09-19 Thread Øivind
On Wednesday, 19 September 2012 at 20:56:17 UTC, Simen Kjaeraas wrote: On Wed, 19 Sep 2012 22:25:46 +0200, Øivind oivind@gmail.com wrote: I am struggeling to get around the cycle detection kicking in when I have static init in modules that depend on eachother. I have seen some threads

Re: static init cycle detection problem

2012-09-19 Thread Øivind
Another way of approaching this would be if I could feed a list of modules into DMD during compile time. In C++, i would be able to do this by passing a define to g++ on the command line when invoking it. Is it possible to do something similar with DMD? E.g. create a list of modules before

AA rehash link error

2012-08-13 Thread Øivind
When building my program by compiling .o files first and then linking, everything links fine, but when I try to compile all the source files at once, I get the following link error: build/debug/dboss-debug.o: In function `@property boss.proc.proccmd.ProcCmd.Cmd[immutable(char)[]]

How to create TypeTuple/ExpressionTuple from tuple/tuples

2012-08-07 Thread Øivind
Given e.g. a function template void f(T ...)(T t) { writeln(t.length); } How can I call this function with an already-constructed tuple but pass the pule as an expressiontuple? auto v = tuple(1, 2, 3); f(v); In the case above, f will print 1 because 1 tuple is given to the function, but

Re: How to create TypeTuple/ExpressionTuple from tuple/tuples

2012-08-07 Thread Øivind
On Tuesday, 7 August 2012 at 16:11:05 UTC, Andrej Mitrovic wrote: On 8/7/12, Øivind oivind@gmail.com wrote: How can I call this function with an already-constructed tuple but pass the pule as an expressiontuple? auto v = tuple(1, 2, 3); f(v); Use the .expand property: f(v.expand) Works