Re: Using replaceInPlace, string and char[]

2015-08-16 Thread TSalm via Digitalmars-d-learn
> Must create a ticket for it ? I think so. Unless others object in 10 minutes... :) :-) Done : https://issues.dlang.org/show_bug.cgi?id=14925 Thanks for your help

Re: Using replaceInPlace, string and char[]

2015-08-15 Thread TSalm via Digitalmars-d-learn
On Saturday, 15 August 2015 at 08:07:43 UTC, Ali Çehreli wrote: This looks like a bug to me. The template constraints of the two overloads are pretty complicated. This case should match only one of them. Yes I understand. I've used ldc2. With DMD (v0.067.1) the error is more clear : inout.d(1

Using replaceInPlace, string and char[]

2015-08-15 Thread TSalm via Digitalmars-d-learn
iating Don't understand why this doesn't work: it compiles fine and runs perfectly if I change "char[]" by "string" ... don't understand why since the documentation says : String literals are immutable (read only). How this function can change a type that is immutable ? Thanks for your help. TSalm

Re: C equivalent for the D "float" type

2009-09-18 Thread TSalm
What is the C equivalent for the D "float" type ? float and double is double. in c, real support is compiler dependant, it may or may not be available. Thanks !

C equivalent for the D "float" type

2009-09-18 Thread TSalm
Hello, What is the C equivalent for the D "float" type ? Thanks in advance, TSalm

Re: Garbage collection in D

2009-06-03 Thread TSalm
Le Wed, 03 Jun 2009 02:40:11 +0200, Diwaker Gupta a écrit: I've just started to play around with D, and I'm hoping someone can clarify this. I wrote a very simple program that just allocates lots of objects, in order to benchmark the garbage collector in D. For comparison, I wrote the pr

Re: convert *void to void[]

2009-05-06 Thread TSalm
Le Wed, 06 May 2009 10:33:33 +0200, TSalm a écrit: Le Wed, 06 May 2009 10:17:47 +0200, gabrielsylar a écrit: can anybody please tell me how to properly convert from void* to void[] as the code below? void[] get_bytes(int n) { return sqlite3_column_blob(stmt, n); } Something like could

Re: convert *void to void[]

2009-05-06 Thread TSalm
Le Wed, 06 May 2009 10:17:47 +0200, gabrielsylar a écrit: can anybody please tell me how to properly convert from void* to void[] as the code below? void[] get_bytes(int n) { return sqlite3_column_blob(stmt, n); } Something like could works : return *( cast(void[]*) sqlite3_column_blob(s

Re: const argument

2009-03-29 Thread TSalm
Le Sat, 28 Mar 2009 17:52:54 +0100, TSalm a écrit: Le Sat, 28 Mar 2009 12:21:52 +0100, Jarrett Billingsley a écrit: On Sat, Mar 28, 2009 at 6:12 AM, TSalm wrote: Hello, Is there a way to specifie a constant argument ( I would say an argument for which his value is evaluate at

Re: const argument

2009-03-28 Thread TSalm
Le Sat, 28 Mar 2009 12:21:52 +0100, Jarrett Billingsley a écrit: On Sat, Mar 28, 2009 at 6:12 AM, TSalm wrote: Hello, Is there a way to specifie a constant argument ( I would say an argument for which his value is evaluate at compile time ) For example, something like this

const argument

2009-03-28 Thread TSalm
) Stdout("Yes").newline; else Stdout("No").newline; } void main() { func( true ); func( false ); } /* END CODE - */ Thanks in advance, TSalm

Re: Template in interface ?

2009-03-01 Thread TSalm
Le Sun, 01 Mar 2009 03:07:16 +0100, Christopher Wright a écrit: TSalm wrote: Does something have an idea on how to do something like this ? You don't. Templates cannot participate in polymorphism. I've dealt with this in the past and ended up making another class with

Template in interface ?

2009-02-28 Thread TSalm
something have an idea on how to do something like this ? Thanks in advance, Tsalm

Re: Generic functions to convert to void* and from void*

2009-02-25 Thread TSalm
Le Wed, 25 Feb 2009 01:03:32 +0100, Daniel Keep a écrit: TSalm wrote: In my case, there's also no possibility to get the wrong type, because it is managed by the type of the ColumnMem. You still have to get the code right. There's a surprising number of corner cases tryin

Re: Generic functions to convert to void* and from void*

2009-02-24 Thread TSalm
TSalm wrote: I'm trying to build function which have the hability to convert a type to void* and from void*. First of all, I have to ask: have you looked at std.variant / tango.core.Variant? Yes, but it seems that Variant class uses more memory than void* . The Phobos Variant wil

Re: Generic functions to convert to void* and from void*

2009-02-23 Thread TSalm
I'm trying to build function which have the hability to convert a type to void* and from void*. First of all, I have to ask: have you looked at std.variant / tango.core.Variant? Yes, but it seems that Variant class uses more memory than void* . [...] I get the distinct impression that you

Re: Generic functions to convert to void* and from void*

2009-02-22 Thread TSalm
I'm trying to build function which have the hability to convert a type to void* and from void*. I must use "ref" in the "toPtr" function because of this : http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=15600 Do you think that what I done

Generic functions to convert to void* and from void*

2009-02-22 Thread TSalm
se { p = &val ; } return p ; } /*** * Convert a void* to his value * Params: * ptr = * Returns: */ T fromPtr(T)(void* ptr) { return *(cast(T*)ptr) ; } /* --- END CODE */ Thanks in advance, TSalm

Re: "Symbol undefined" on interface with public getter and package setter

2009-02-21 Thread TSalm
Le Sat, 21 Feb 2009 04:00:42 +0100, Daniel Keep a écrit: TSalm wrote: I'm not sure but I think package is not virtual. :-( So there's really no way to have a method declared "package" in an interface ? You also can't have a private function in an interface

Re: "Symbol undefined" on interface with public getter and package setter

2009-02-20 Thread TSalm
I'm not sure but I think package is not virtual. :-( So there's really no way to have a method declared "package" in an interface ?

Re: "Symbol undefined" on interface with public getter and package setter

2009-02-20 Thread TSalm
w A ; a.func = 10 ; Stdout(a.func).newline ; } /* --- END CODE */ Thanks in advance for your help, TSalm

"Symbol undefined" on interface with public getter and package setter

2009-02-20 Thread TSalm
.func).newline ; } /* --- END CODE */ Thanks in advance for your help, TSalm

Re: Template function : use the array's one !

2009-02-18 Thread TSalm
TSalm Wrote: int compare(T:T[])(T[] o1,T[] o2) Change this line to: int compare(T:T[])(T o1, T o2) You are right. But despite this function, at compile time, an error is return : .\src\tsalm\tools\Generic.d(20): Error: cannot implicitly convert expression (o2 - o1) of type int[3u

Re: Template function : use the array's one !

2009-02-17 Thread TSalm
Le Tue, 17 Feb 2009 23:03:04 +0100, BCS a écrit: Hello TSalm, take a look at static if and is http://www.digitalmars.com/d/1.0/version.html#staticif http://www.digitalmars.com/d/1.0/expression.html#IsExpression Thanks for this links. But I don't see anything about how to test if it

Re: Template function : use the array's one !

2009-02-17 Thread TSalm
take a look at static if and is http://www.digitalmars.com/d/1.0/version.html#staticif http://www.digitalmars.com/d/1.0/expression.html#IsExpression Thanks for this links. But I don't see anything about how to test if it's an array or not... Is it not possible ?

Template function : use the array's one !

2009-02-17 Thread TSalm
ating It seems it's the first compare function (without array in parameter) which is hook. How can I declare this compare function to use specific code to compare arrays ? Thanks in advance, TSalm

Re: return *(cast(T*)vPtr) and OutOfMemoryException

2009-02-14 Thread TSalm
Excellent explication ! Thank you Frits Le Sat, 14 Feb 2009 17:58:35 +0100, Frits van Bommel a écrit: TSalm wrote: Hello, In the code below, why the first Stdout throws a Exception when the second doesn't ? /* CODE */ import tango.io.Stdout; struct Void

return *(cast(T*)vPtr) and OutOfMemoryException

2009-02-14 Thread TSalm
s works good } /* -- END CODE -- */ Thanks in advance for your help, TSalm

Re: myClass.add(something)(otherthings)(thisToo);

2008-12-09 Thread tsalm
Le Wed, 10 Dec 2008 03:16:49 +0100, Denis Koroskin <[EMAIL PROTECTED]> a écrit: On Wed, 10 Dec 2008 03:24:48 +0300, Jarrett Billingsley <[EMAIL PROTECTED]> wrote: On Tue, Dec 9, 2008 at 7:00 PM, BCS <[EMAIL PROTECTED]> wrote: class C { final void add(T...)(T t) { foreach(int i,_

myClass.add(something)(otherthings)(thisToo);

2008-12-09 Thread tsalm
Hello, How to implement an object that can do this : myClass.add(something)(otherthings)(thisToo); Is it possible ? TIA, TSalm

Re: Internal delegate and Stack Overflow

2008-11-29 Thread tsalm
Le Sat, 29 Nov 2008 01:49:20 +0100, BCS <[EMAIL PROTECTED]> a écrit: struct C(R, A...) { A args; R function(A) dg; static R delegate() opCall(R function(A) dg, A a) { C!(R, A) ret; ret.dg=dg; foreach(int i,_;A) ret.args[i] = a[i]; return &ret.fn; } R fn()

Re: Internal delegate and Stack Overflow

2008-11-28 Thread tsalm
Le Sat, 29 Nov 2008 01:08:28 +0100, BCS <[EMAIL PROTECTED]> a écrit: Reply to TSalm, Hello, I would do something like this, but this return me an execution error : object.Exception: Stack Overflow // CODE class A { void delegate() dg; void doIt() { dg(); } } class B

Internal delegate and Stack Overflow

2008-11-28 Thread tsalm
() { } } void main() { auto b = new B; b.a.doIt(); } // --END CODE-- Is this a bug or have I do something wrong ? Thanks in advance for your help, TSalm

Re: Compilation error when using a extern function ?

2008-11-21 Thread tsalm
Le Fri, 21 Nov 2008 00:34:03 +0100, Denis Koroskin <[EMAIL PROTECTED]> a écrit: union ColorProxy { uint color; struct { ubyte red; ubyte green; ubyte blue; ubyte alpha; } } ColorProxy proxy; proxy.color = ColorValues.Aqua; return Color(proxy.red, proxy.gre

Compilation error when using a extern function ?

2008-11-20 Thread tsalm
o "const Color colorPanMonth = convertToColor(cast(uint)ColorValues.MidnightBlue);" Thanks in advance for your help, TSalm