On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote:
Is there any examples that shows how to properly allocate an
object of a class type with the new allocators and then release
it when desired?
This is more or less the same answer as you've get previously
except that I don't use emplace
Generally don't override methods in GtkD, use event handlers like
addOnDraw. Because GtkD wraps GTK functions an overriden D method
of GtkD will never get called by GTK since it is working with the
underlying C functions directly.
On Wednesday, 27 January 2016 at 01:54:53 UTC, Enjoys Math wrote:
import gtk.MainWindow;
import gtk.Main;
import gtk.DrawingArea;
import cairo.Context;
import std.stdio;
void main(string[] args) {
Main.init(args);
auto win = new MainWindow("Hello World");
win.setDefaultSize(200, 100)
import gtk.MainWindow;
import gtk.Main;
import gtk.DrawingArea;
import cairo.Context;
import std.stdio;
void main(string[] args) {
Main.init(args);
auto win = new MainWindow("Hello World");
win.setDefaultSize(200, 100);
win.add(new MyDrawingArea());
win.showAll();
Main.run
On Tuesday, 26 January 2016 at 22:30:24 UTC, Enjoys Math wrote:
On Tuesday, 26 January 2016 at 22:10:42 UTC, Enjoys Math wrote:
I get this message either compiling at command line -or- in
VisualD.
At command line when I add -m64, I get another error:
C:\MyProjects\___LIGHTSHOWAPP\___LIGHTSHO
On Wednesday, 27 January 2016 at 01:20:49 UTC, Mike Parker wrote:
has no connection library files
has no relationship with library files
What I mean is it is not used to specify libraries.
On Wednesday, 27 January 2016 at 00:17:18 UTC, Ali Çehreli wrote:
Remove the extra is: :)
Huh, I swear I tried that. Thanks!
On Tuesday, 26 January 2016 at 21:23:28 UTC, Igor wrote:
um? Memory manager? I am doing it manually C++ style so I don't
have to worry about the god forsaken memory manager. Why is it
so difficult? I create the object and release it when I need to.
He's talking about *your* memory manager,
On 01/26/2016 04:12 PM, pineapple wrote:
> Here's a simple programming showing where I'm tripping up -
>
> void test(T)(in T value){
> import std.traits;
> static if(is(T == char)){
> writeln("char");
> }else static if(is(isNumeric!(T))){
Remove the extra is: :)
}else
Here's a simple programming showing where I'm tripping up -
void test(T)(in T value){
import std.traits;
static if(is(T == char)){
writeln("char");
}else static if(is(isNumeric!(T))){
writeln("number");
}
writeln("hi");
}
public void main(){
test('g');
Hello
$ cat t.d
import std.net.curl: get;
void main() {
string[string] x;
string y = x.get("","");
}
$ dmd t.d
t.d(6): Error: template std.net.curl.get cannot deduce function
from argument types !()(string[string], string, string),
candidates are:
/usr/include/dmd/phobos/std/net/curl
On Tue, Jan 26, 2016 at 08:54:34PM +, Chris Wright via Digitalmars-d-learn
wrote:
> On Tue, 26 Jan 2016 18:16:28 +, Gerald Jansen wrote:
>
> > On Thursday, 21 January 2016 at 21:24:49 UTC, H. S. Teoh wrote:
> >>
> >> While this is no fancy range-based code, and one might say it's
> >> mor
On 01/26/2016 01:21 PM, Igor wrote:
> I allocate in a static method called New once. I then deallocate in the
> destructor. Basically just as one would do in C++.
I would never do that in even C++. I don't know any C++ idiom that
warrants 'delete this' where superior alternatives cannot be used
On Tuesday, 26 January 2016 at 22:10:42 UTC, Enjoys Math wrote:
I get this message either compiling at command line -or- in
VisualD.
At command line when I add -m64, I get another error:
C:\MyProjects\___LIGHTSHOWAPP\___LIGHTSHOWAPP>dmd -m64 main.d
-L+gtkd
LINK : fatal error LNK1181: cannot
I get this message either compiling at command line -or- in
VisualD.
At command line when I add -m64, I get another error:
C:\MyProjects\___LIGHTSHOWAPP\___LIGHTSHOWAPP>dmd -m64 main.d
-L+gtkd
LINK : fatal error LNK1181: cannot open input file '+gtkd.obj'
--- errorlevel 1181
On Tuesday, 26 January 2016 at 03:03:40 UTC, Igor wrote:
Is there a GC-less array that we can use out of the box or do I
have to create my own?
If you want containers, use:
http://code.dlang.org/packages/emsi_containers
If you just need an array, use:
http://dlang.org/phobos/std_experimental_
On Tuesday, 26 January 2016 at 20:54:34 UTC, Chris Wright wrote:
On Tue, 26 Jan 2016 18:16:28 +, Gerald Jansen wrote:
On Thursday, 21 January 2016 at 21:24:49 UTC, H. S. Teoh wrote:
While this is no fancy range-based code, and one might say
it's more hackish and C-like than idiomatic D, t
On Tuesday, 26 January 2016 at 22:04:55 UTC, Enjoys Math wrote:
[...]
Okay, fixed by changing 'gtkd' setting to 'gtkd.lib'.
On Tuesday, 26 January 2016 at 21:23:28 UTC, Igor wrote:
On Tuesday, 26 January 2016 at 20:17:20 UTC, Steven
Schveighoffer wrote:
On 1/26/16 9:20 AM, Igor wrote:
[...]
Don't do it in the destructor.
I can only imagine that you are triggering the destructor with
destroy? In this case, destro
I'm getting:
SeverityCodeDescription Project FileLine
Error Error 42: Symbol Undefined
_D3gtk4Main12__ModuleInfoZ C:\MyProjects\___LIGHTSHOWAPP\WindowsApp1\
Error Error 42: Symbol Undefined
_D3gtk5Label5Label7__ClassZ C:\MyProjects\___LIGHTSHOWAPP\WindowsApp1\
Error E
On Tuesday, 26 January 2016 at 21:23:28 UTC, Igor wrote:
On Tuesday, 26 January 2016 at 20:17:20 UTC, Steven
Schveighoffer wrote:
On 1/26/16 9:20 AM, Igor wrote:
I have successfully malloc'ed an object but when I go to free
it in the
destructor I get an exception. The destructor simply has
~t
On Tuesday, 26 January 2016 at 19:34:22 UTC, Ali Çehreli wrote:
On 01/26/2016 06:20 AM, Igor wrote:
> I have successfully malloc'ed an object but when I go to free
it in the
> destructor I get an exception. The destructor simply has
>
> ~this() // destructor for Foo
> {
> core.stdc.stdlib.fr
On Tuesday, 26 January 2016 at 20:17:20 UTC, Steven Schveighoffer
wrote:
On 1/26/16 9:20 AM, Igor wrote:
I have successfully malloc'ed an object but when I go to free
it in the
destructor I get an exception. The destructor simply has
~this() // destructor for Foo
{
core.stdc.stdlib.free(&
On Tue, 26 Jan 2016 18:16:28 +, Gerald Jansen wrote:
> On Thursday, 21 January 2016 at 21:24:49 UTC, H. S. Teoh wrote:
>>
>> While this is no fancy range-based code, and one might say it's more
>> hackish and C-like than idiomatic D, the problem is that current D
>> compilers can't quite optim
On 1/26/16 9:20 AM, Igor wrote:
I have successfully malloc'ed an object but when I go to free it in the
destructor I get an exception. The destructor simply has
~this() // destructor for Foo
{
core.stdc.stdlib.free(&this);
}
auto buffer = core.stdc.stdlib.malloc(__traits(classInstanceSize
On 01/26/2016 11:42 AM, tcak wrote:
>> struct S {
>> void memberFunction() {
>> }
>> }
>> auto s = S();
>>
>> auto memberClosure(ref S s) {
>> return () => s.memberFunction();
>> }
>>
>> events ~= new ConcreteEvent!(() => memberClosure(s),
>>
On Tuesday, 26 January 2016 at 19:22:58 UTC, Ali Çehreli wrote:
On 01/26/2016 10:41 AM, tcak wrote:
> I need/want this class to be able to bind
> a function, a method, or a shared method. From the
perspective of class
> design, there shouldn't be any
> difference. Its purpose is to let know about
On Tuesday, 26 January 2016 at 19:42:42 UTC, tcak wrote:
On Tuesday, 26 January 2016 at 19:22:58 UTC, Ali Çehreli wrote:
[...]
Hmm. Your example works fine for functions, but I can't pass a
method instead of function as alias. Check my example:
[...]
Edit: ... "I guess because it is runti
On 01/26/2016 06:20 AM, Igor wrote:
> I have successfully malloc'ed an object but when I go to free it in the
> destructor I get an exception. The destructor simply has
>
> ~this() // destructor for Foo
> {
> core.stdc.stdlib.free(&this);
> }
That design suggests a complexity regarding objec
What a lousy copy+paste mistake that was. I am glad no credit card
number leaked there. :p
On 01/26/2016 11:22 AM, Ali Çehreli wrote:
> class ConcreteEvent(alias onStart, alias onStop, alias onItemAdded) :
> void itemAdded(size_t itemIndex) {
> itemAdded(itemIndex);
> }
That
On 01/26/2016 10:41 AM, tcak wrote:
> I need/want this class to be able to bind
> a function, a method, or a shared method. From the perspective of class
> design, there shouldn't be any
> difference. Its purpose is to let know about the event, not to care
> about how the event
> handler is design
On Tuesday, 26 January 2016 at 06:27:49 UTC, H. S. Teoh wrote:
On Sun, Jan 24, 2016 at 06:07:41AM +, Jesse Phillips via
Digitalmars-d-learn wrote: [...]
My suggestion is to take the unittests used in std.csv and try
to get your code working with them. As fastcsv limitations
would prevent re
In many multi threading module designs of mine, I generally
design a base class, and
this class have some events. Exempli gratia:
void eventOnStart();
void eventOnStop();
void eventOnItemAdded( size_t itemIndex );
There is this problem though. I need/want this class to be able
to bind a functi
On Tuesday, 26 January 2016 at 18:07:40 UTC, ZombineDev wrote:
[snip]
Cool example.
On Thursday, 21 January 2016 at 21:24:49 UTC, H. S. Teoh wrote:
While this is no fancy range-based code, and one might say it's
more hackish and C-like than idiomatic D, the problem is that
current D compilers can't quite optimize range-based code to
this extent yet. Perhaps in the future opt
On Tuesday, 26 January 2016 at 14:55:53 UTC, Wilson wrote:
Just wondering how to create a dense multidimensional array
with the GC free array container? I don't want to use an array
of arrays but I do want the array[0][0] notation.
I suggest using std.experimental.ndslice [1] for multidimensio
On Thursday, 6 February 2014 at 23:06:03 UTC, QAston wrote:
How do i get aliases to overloads of a template method like
Class A
{
int a(T)(T tq,T tw);
int a(T)(T tq);
}
__traits(getOverloads, A, "a(int)")doesnt work
Bump. I also have a similar problem. I have a module with two
functio
On Tuesday, 26 January 2016 at 15:54:14 UTC, Voitech wrote:
How to handle this correctly?
Make BaseParser the value type of the AA. Parser!Foo and
Parser!Bar are subtypes of BaseParser.
Unlike Java, just `Parser` is not a type but a template. It must
be instantiated to create a type. Java i
Hello, I'm having problem with converting from Java style coding
to D, probably doing wrong something. I want to have a map
(associative array) which will return specific object depending
on provided key. Key is a type of other object. Let say i want to
hold single instances of some kind of par
On Tuesday, 26 January 2016 at 14:48:48 UTC, Daniel Kozak wrote:
V Tue, 26 Jan 2016 14:20:29 +
Igor via Digitalmars-d-learn
napsáno:
[...]
core.stdc.stdlib.free(cast(void *)this);
I still get an exception:
Exception thrown at 0x7FF6C7CA3700 in test.exe: 0xC005:
Access violati
V Tue, 26 Jan 2016 15:24:00 +
Igor via Digitalmars-d-learn
napsáno:
> On Tuesday, 26 January 2016 at 14:48:48 UTC, Daniel Kozak wrote:
> > V Tue, 26 Jan 2016 14:20:29 +
> > Igor via Digitalmars-d-learn
> > napsáno:
> >
> >> [...]
> >
> > core.stdc.stdlib.free(cast(void *)this);
>
On Tuesday, 26 January 2016 at 13:56:39 UTC, Igor wrote:
//ubyte[__traits(classInstanceSize, App)] buffer;
auto buffer =
core.stdc.stdlib.malloc(__traits(classInstanceSize,
App))[0..__traits(classInstanceSize, App)];
works, so it is the ubyte line.
Make sure the buffer out
On Tuesday, 26 January 2016 at 13:56:39 UTC, Igor wrote:
//ubyte[__traits(classInstanceSize, App)] buffer;
auto buffer =
core.stdc.stdlib.malloc(__traits(classInstanceSize,
App))[0..__traits(classInstanceSize, App)];
works, so it is the ubyte line.
Can you please post the f
Just wondering how to create a dense multidimensional array with
the GC free array container? I don't want to use an array of
arrays but I do want the array[0][0] notation.
V Tue, 26 Jan 2016 14:20:29 +
Igor via Digitalmars-d-learn
napsáno:
> I have successfully malloc'ed an object but when I go to free it
> in the destructor I get an exception. The destructor simply has
>
> ~this() // destructor for Foo
> {
> core.stdc.stdlib.free(&this);
> }
>
>
> aut
V Tue, 26 Jan 2016 13:56:39 +
Igor via Digitalmars-d-learn
napsáno:
> On Tuesday, 26 January 2016 at 09:32:06 UTC, Daniel Kozak wrote:
> > V Tue, 26 Jan 2016 05:47:42 +
> > Igor via Digitalmars-d-learn
> > napsáno:
> >
> >> On Tuesday, 26 January 2016 at 05:11:54 UTC, Mike Parker wrote
I have successfully malloc'ed an object but when I go to free it
in the destructor I get an exception. The destructor simply has
~this() // destructor for Foo
{
core.stdc.stdlib.free(&this);
}
auto buffer = core.stdc.stdlib.malloc(__traits(classInstanceSize,
App))[0..__traits(classInstanc
On Tuesday, 26 January 2016 at 09:32:06 UTC, Daniel Kozak wrote:
V Tue, 26 Jan 2016 05:47:42 +
Igor via Digitalmars-d-learn
napsáno:
On Tuesday, 26 January 2016 at 05:11:54 UTC, Mike Parker wrote:
> [...]
Can you try it with GC.disable()?
//ubyte[__traits(classInstanceSize, App)] buffe
On Tuesday, 26 January 2016 at 09:32:06 UTC, Daniel Kozak wrote:
V Tue, 26 Jan 2016 05:47:42 +
Igor via Digitalmars-d-learn
napsáno:
[...]
Can you try it with GC.disable()?
Didn't change anything.
On Monday, 25 January 2016 at 19:45:21 UTC, Igor wrote:
Am I off target here?
Dlls are currently not properly supported in D, I would strongly
advice against using them. Just link everything statically and be
happy for now.
Kind Regards
Benjamin Thaut
On Tuesday, 26 January 2016 at 06:27:49 UTC, H. S. Teoh wrote:
My thought is to integrate the fastcsv code into std.csv, such
that the current std.csv code will serve as fallback in the
cases where fastcsv's limitations would prevent it from being
used, with fastcsv being chosen where possible.
On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote:
Is there any examples that shows how to properly allocate an
object of a class type with the new allocators and then release
it when desired?
There are a number of different patterns discussed and
illustrated with examples at
http://wi
On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote:
Is there any examples that shows how to properly allocate an
object of a class type with the new allocators and then release
it when desired?
There's an example of class object allocation in the
std.experimental.allocator docs:
// Dyn
V Tue, 26 Jan 2016 05:47:42 +
Igor via Digitalmars-d-learn
napsáno:
> On Tuesday, 26 January 2016 at 05:11:54 UTC, Mike Parker wrote:
> > On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote:
> >> Is there any examples that shows how to properly allocate an
> >> object of a class type w
On Tuesday, 26 January 2016 at 05:53:29 UTC, Igor wrote:
On Tuesday, 26 January 2016 at 04:38:13 UTC, Adam D. Ruppe
wrote:
On Tuesday, 26 January 2016 at 04:31:07 UTC, Igor wrote:
then std.algorithm.find!("a.myInt == b")(classes, 3)
Try
std.algorithm.find!("a.myInt == b")(classes[], 3)
noti
55 matches
Mail list logo