On 10.02.2010 22:28, GG wrote:
> I try to use variant as associative array with dmd2.039,
>
> Variant[char[]][int] aa;
> aa[0]["Month"] = "Jan";
> aa[0]["Profit"] = 500;
> aa[1]["Month"] = "Feb";
> aa[1]["Profit"] = 800;
>
> I got core.exception.rangeer...@main(28): Range violation
> I'm doing s
On 10.02.2010 14:41, daoryn wrote:
>>
>> The buffer you are passing to receive is 0 bytes long. The
>> std.socket.Socket.receive function is a wrapper over the normal socket
>> function, and includes a test for an empty buffer.
>>
>> Daniel
>
> Ohh, I see. Thank you!
>
> I thought that the fun
Alex wrote:
> Is it possible, using templates, tuples, or some other mechanism, to
> implement named variadic arguments in D?
>
> For example, I'd like to be able to do something like...
> foo( 2, &bar, age : 10, status : "down");
>
> and so forth.
Yes, with a small hack.
typedef int age_type;
funog wrote:
> The following code :
>
> --
> import std.stdio;
> class A {
> void foo(A a) {
> writefln("A");
> }
> }
>
> class B : A {
> void foo(B b) {
> writefln("B");
> }
> }
>
> void main() {
> B b = new B;
> A a = b;
> assert(a is
Nick Sabalausky wrote:
> "BCS" wrote in message
> news:a6268ffc3898cc29d1f554d...@news.digitalmars.com...
>> Hello Nick,
>>
>>
>>> So...is there any trickery I
>>> could do so that SubFoo!("sam") and SubFoo!("sam", "human") would
>>> resolve to the same subclass of Foo?
>> Make a SubFoo!(char[] s
Bill Baxter wrote:
> You query presence of a key in an AA using 'in'
>
> if (id in symtab) {
> Symbol sym = symtab[id];
> ...
> } else {
> ..
> }
>
> Or this avoids a double lookup if the symbol is present:
>
> Symbol* pSym = id in symtab;
> if (pSym !is null) {
>
auto like this to?
>
Sadly, it's an if-specific syntax.
> Thank you for taking the time downs,
>
> -- Justin
Anytime.
Craig Kuhnert wrote:
> Hi
> I am trying to convert some code I wrote in C++ to D to give it a try and I
> have come across some code that I dont know how to convert.
> I have simplified the code to illustrate the problem I have.
> How do I do this in D?
>
> class IFieldSetter
> {
> public:
>
Justin Johansson wrote:
> Daniel Keep Wrote:
>
>> Justin Johansson wrote:
>>> There was mention** on the general discussion group that the D
>>> foreach_reverse
>>> language construct could be replaced (emulated?) with a (D) meta-program.
>>>
>>> ** "Even a novice programmer can write a meta-prog
Stewart Gordon wrote:
> downs wrote:
>
>> while (auto len = file.readBlock(buffer.ptr, buffer.sizeof))
>
>
> md5_example_2.d(7): expression expected, not 'auto'
> md5_example_2.d(7): found 'len' when expecting ')'
> md5_example_2.d(7): fo
notna wrote:
> Stewart Gordon schrieb:
>> The .ptr is necessary, but the cast(uint) isn't. Even if a change of
>> type were necessary, just 1U would do. (U is a suffix meaning
>> unsigned. There's also L meaning long.)
>>
>> Stewart.
>
> Thank Stewart.
>
> As the std.md5-example is not working
bearophile wrote:
> I don't know much C++. Can CRTP be used in D1 too, to improve the performance
> of some D1 code?
>
> http://en.wikipedia.org/wiki/Curiously_Recurring_Template_Pattern
>
> Bye,
> bearophile
We have this, except we call it "template mixin" :)
Saaa wrote:
> I thought my previous precision question was so retarded it didn't need any
> explanation; anybody here could easily tell me my fault in reasoning.
>
> Here is my question again but this time with examples.
>
> Is there some formatting which lets me print out a floating point in full
Saaa wrote:
> I thought my previous precision question was so retarded it didn't need any
> explanation; anybody here could easily tell me my fault in reasoning.
>
> Here is my question again but this time with examples.
>
> Is there some formatting which lets me print out a floating point in fu
Jarrett Billingsley wrote:
> On Tue, Jul 7, 2009 at 8:29 AM, downs wrote:
>> But then isn't what he asks for kinda impossible by design? I mean,
>> interfaces are bound at runtime. That's what they _do_.
>>
>
> Now read *my* post, downs. ;)
:blushes:
downs wrote:
> Jarrett Billingsley wrote:
>> On Sun, Jul 5, 2009 at 5:44 AM, downs wrote:
>>> Doctor J wrote:
>>>> I want to write an interface that expresses the following idea: "classes
>>>> implementing this interface must have a void function nam
Jarrett Billingsley wrote:
> On Sun, Jul 5, 2009 at 5:44 AM, downs wrote:
>> Doctor J wrote:
>>> I want to write an interface that expresses the following idea: "classes
>>> implementing this interface must have a void function named update, with a
>&
BCS wrote:
> Hello AxelS,
>
>> BCS Wrote:
>>
>>> You can't. The D runtime (and most other runtimes) don't ever reduce
>>> the amount of memory they keep in the heap. If you where to allocate
>>> another 25MB right after that function you would see no change in the
>>> memory usage. The good news i
Doctor J wrote:
> I want to write an interface that expresses the following idea: "classes
> implementing this interface must have a void function named update, with a
> fixed but indeterminate number of parameters of the same (template parameter)
> type."
Use a typesafe variadic function, i.e
novice2 wrote:
> downs Wrote:
>> Here's a way to do it.
>>
>> Enjoy! :)
>>
>> Usage example:
>>
>> struct Test {
>> ... skipped...
>
> Thank you, downs, for your job!
>
> but, heh, i can't use something, that i can
novice2 wrote:
> does anyone know: is D2 std.bitmanip compatible with C bitfields?
> can i use it, if i need translate .h file with something like this:
>
> typedef struct {
> unsigned int can_compress : 1;
> unsigned int can_uncompress : 1;
> unsigned int can_get_info : 1;
> unsig
Jarrett Billingsley wrote:
> On Mon, Jun 15, 2009 at 10:15 PM, Derek Parnell wrote:
>> On Mon, 15 Jun 2009 21:47:53 -0400, Jarrett Billingsley wrote:
>> I've actually given up trying to influence D ... the patricians have made
>> it too hard to contribute and I've haven't got *that* much free time.
Saaa wrote:
> Thanks!
> I thought about the idea of just creating the code and mix it in, but now I
> can see why I failed at that: Your code is kind of read-only to me, for now,
> because I need to change it a bit to accept an array instead of seperat
> indices.
>
> Wouldn't it be nice if it w
Saaa wrote:
> I can't figure out how to create the IndexArray function,
> it should work on arrays of any depth
>
> int[][][] array; //any depth
> array.length=10;
> array[1].length=3;
> array[1][2].length=4;
> array[1][2][1]=99;
>
> writefln(array);
> //[[],[[],[],[0,99,0,0]],[],[],[],[],[],[],[
Saaa wrote:
> Is there a function to check whether some string is a legal identifier?
>
>
Sure.
static if(is(typeof({ /* code to be checked for validity goes here */ }))) ...
gabrielsylar wrote:
> 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); }
In unrelated matters: if you're writing a sqlite3 binding, take a look at
tools.sqlite3. :)
http://dsource.org/
reimi gibbons wrote:
> downs Wrote:
>
>> reimi gibbons wrote:
>>> im failry new to D, is there any D library project with support for SQLite,
>>> if not is there any guide so i can integrate sqlite amalgamated c source
>>> (sqlite3.c, sqlite3.h) into my
reimi gibbons wrote:
> im failry new to D, is there any D library project with support for SQLite,
> if not is there any guide so i can integrate sqlite amalgamated c source
> (sqlite3.c, sqlite3.h) into my D code.
tools.sqlite3 might work for you. Ask me if you have any questions about it.
htt
AxelS wrote:
> Hello evrybody...
>
> I want to use all the opengl extensions like Shaders in my D2.0 prog...
> I already got the opengl32.lib and also the headers...
>
> I tried it wglGetProc (similar name...)! I could compile it but it hangs up
> runtime and creates errors which dont tell me th
doesn't it?
>
> I wouldn't want to mention the 'T' word for fear of Downs accusing me
> of proselytizing.
:snort:
I do agree in this case. I just don't like it when Tango is proposed as an
alternative and the existence of a perfectly valid Phobos solution is ignored.
Jimi_Hendrix wrote:
> Hi, I am new to D but not to programming. I have had some socket experience
> before. How would i connect to a server using sockets in D? A link to a D
> socket tutorial (if one exists) would also be appreciated.
>
> by the way, first post to a newsgroup for me
As certa
BCS wrote:
> Hello BCS,
>
>> I have a program that runs an "easily" parallelizable loop. When I run
>> it as a single thread it only takes about 10% longer than 2 threads
>> (on a dual-core). I'm trying to track down the lossed time and am
>> wondering if turning on -profile is even worth looking
The Anh Tran wrote:
> Hi,
>
> When porting from c++ to D, i encounter this strange discrimination:
> 1. Built-in AA:
> int[int] arr;
> arr[123] += 12345;
> arr[321]++;
>
> 2. Tango HashMap:
> auto hm = new HashMap!(int, int)();
> hm[123] += 12345; // error not lvalue
> hm[
downs wrote:
> jicman wrote:
>> Greetings.
>>
>> Sorry guys, please be patient with me. I am having a hard time
>> understanding this Unicode, ANSI, UTF* ideas. I know how to get an UTF8
>> File and turn it into ANSI. and I know how to take a ANSI file and t
BCS wrote:
> Reply to Jarrett,
>
>> On Fri, Feb 27, 2009 at 9:01 AM, Qian Xu
>> wrote:
>>
>>> Hi All,
>>>
>>> Is there any way to keep program alive, when an AV takes place?
>>>
>> It's possible on Windows in D, but that's because Windows reports
>> segfaults with the same mechanism that D uses f
jicman wrote:
> Greetings.
>
> Sorry guys, please be patient with me. I am having a hard time understanding
> this Unicode, ANSI, UTF* ideas. I know how to get an UTF8 File and turn it
> into ANSI. and I know how to take a ANSI file and turn it into an UTF file.
> But, now I have a Unicode f
Jarrett Billingsley wrote:
> On Sat, Jan 10, 2009 at 12:30 AM, Jarrett Billingsley
> wrote:
>> On Sat, Jan 10, 2009 at 12:18 AM, yes wrote:
>>> Does Phobos also do threadpools?
>> From what I understand, not without modification. At least, not
>> efficiently. D
37 matches
Mail list logo