Re: problems with std.bitmanip.append (bug?)

2015-03-26 Thread Hugo via Digitalmars-d-learn
On Thursday, 26 March 2015 at 02:39:56 UTC, Steven Schveighoffer wrote: An array as an output range writes to the front. You can use std.array.Appender to get appending behavior. I know, it's weird. Alternatively, you can add more bytes to the array, and append to the slice, but that may

Re: Problem overloading operator for a struct with an immutable member

2015-03-26 Thread ketmar via Digitalmars-d-learn
On Thu, 26 Mar 2015 09:02:53 +, Nicolas Sicard wrote: On Thursday, 26 March 2015 at 04:57:55 UTC, ketmar wrote: by the way. do you know that you still CAN overload postincrement operation? yes, the code is still here, and it works... somethimes. ;-) Thnaks. Indeed, this works: ---

Re: Problem overloading operator for a struct with an immutable member

2015-03-26 Thread ketmar via Digitalmars-d-learn
On Thu, 26 Mar 2015 09:17:21 +, ketmar wrote: worth nothing heh. my pet misspelling. signature.asc Description: PGP signature

Re: Problem overloading operator for a struct with an immutable member

2015-03-26 Thread Nicolas Sicard via Digitalmars-d-learn
On Thursday, 26 March 2015 at 04:57:55 UTC, ketmar wrote: by the way. do you know that you still CAN overload postincrement operation? yes, the code is still here, and it works... somethimes. ;-) Thnaks. Indeed, this works: --- struct S { int i; immutable(Object) o; void

Re: std.typecons.Flag -- public import for API users?

2015-03-26 Thread rcorre via Digitalmars-d-learn
On Tuesday, 24 March 2015 at 16:41:28 UTC, Rene Zwanenburg wrote: Should not be necessary. privately import Flag and make a public alias: module a; import std.typecons : Flag; alias SomeFlag = Flag!SomeFlag; SomeFlag.Yes and SomeFlag.No should be usable in other modules without additional

Re: problems with std.bitmanip.append (bug?)

2015-03-26 Thread Hugo via Digitalmars-d-learn
On Thursday, 26 March 2015 at 10:07:07 UTC, Hugo wrote: If only the documentation and/or test units were more clear... OK, I made a simpler test, using an example from the documentation: void main() { import std.stdio, std.array, std.bitmanip; auto buffer = appender!(const

Re: problems with std.bitmanip.append (bug?)

2015-03-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/26/15 6:07 AM, Hugo wrote: On Thursday, 26 March 2015 at 02:39:56 UTC, Steven Schveighoffer wrote: An array as an output range writes to the front. You can use std.array.Appender to get appending behavior. I know, it's weird. Alternatively, you can add more bytes to the array, and append

Re: problems with std.bitmanip.append (bug?)

2015-03-26 Thread John Colvin via Digitalmars-d-learn
On Thursday, 26 March 2015 at 12:21:23 UTC, Hugo wrote: On Thursday, 26 March 2015 at 10:07:07 UTC, Hugo wrote: If only the documentation and/or test units were more clear... OK, I made a simpler test, using an example from the documentation: void main() { import std.stdio, std.array,

Re: Looking for a little help with the win32 headers

2015-03-26 Thread rumbu via Digitalmars-d-learn
On Friday, 27 March 2015 at 01:27:25 UTC, Belly wrote: If anyone reading this can save me some time and help me with this: How to declare a byte pattern, for example to pass to WriteProcessMemory? I guess it's uint[] bytes; How do I set it to 0x12345678 ? Since WriteProcessMemory

Re: Looking for a little help with the win32 headers

2015-03-26 Thread rumbu via Digitalmars-d-learn
On Thursday, 26 March 2015 at 16:46:06 UTC, Belly wrote: No, wait, the first code is even better because it uses the headers so I don't need to declare the API myself and it uses the MAX_COMPUTERNAME_LENGTH define, too, nice! Using this will return only the first 15 characters of the

Re: Looking for a little help with the win32 headers

2015-03-26 Thread Belly via Digitalmars-d-learn
No, wait, the first code is even better because it uses the headers so I don't need to declare the API myself and it uses the MAX_COMPUTERNAME_LENGTH define, too, nice!

Re: need help with CTFE

2015-03-26 Thread anonymous via Digitalmars-d-learn
On Thursday, 26 March 2015 at 16:19:17 UTC, Dmitri Makarov wrote: When I compile version DOES_NOT_WORK, I get the following error: c/tool.d(13): Error: variable name cannot be read at compile time c/tool.d(13):while looking for match for hasMember!(Tool, name) However, the other

need help with CTFE

2015-03-26 Thread Dmitri Makarov via Digitalmars-d-learn
I'm compiling the following application (2 d modules) // file c/tool.d module c.tool; struct Tool { string name; auto generate() { version (DOES_NOT_WORK) { import std.traits : hasMember; if (hasMember!(Tool, name)) return `writeln(this is a ` ~ mixin (this. ~

Re: Looking for a little help with the win32 headers

2015-03-26 Thread Belly via Digitalmars-d-learn
Thank you guys, I tried the second reply and it works great!

Re: need help with CTFE

2015-03-26 Thread Dmitri Makarov via Digitalmars-d-learn
On Thursday, 26 March 2015 at 17:30:40 UTC, anonymous wrote: value parameter. You cannot do that, because `name` is a dynamic value but you can only pass a static value there. (There may be better terms than dynamic/static value.) Thank you, anonymous. It makes sense. I guess rather than

feature request for dlang.org library preview

2015-03-26 Thread Steven Schveighoffer via Digitalmars-d-learn
So I just noticed, when I click on source code button for a function in dlang.org library preview, it brings me to the source code as of that release, but to the file itself (on github). I'd like it to go to the specific line where that function is defined instead. I'm not sure if we need

Re: problems with std.bitmanip.append (bug?)

2015-03-26 Thread Hugo via Digitalmars-d-learn
On Thursday, 26 March 2015 at 12:29:03 UTC, John Colvin wrote: On Thursday, 26 March 2015 at 12:21:23 UTC, Hugo wrote: Also, can anyone provide a similar example but using little endian order? If only to contrast differences between modes of invocation... void main() { import

HTTP() from std.net.curl hidden state

2015-03-26 Thread Ilya Korobitsyn via Digitalmars-d-learn
Hello! I am using HTTP structure to perform calls to a simple REST API. Like this: class API { HTTP http; this() { http = HTTP(); } void call() { http.url = some url; http.method = POST; http.setPostData(data, type); http.perform(); }

Re: Looking for a little help with the win32 headers

2015-03-26 Thread Belly via Digitalmars-d-learn
On Thursday, 26 March 2015 at 17:41:37 UTC, rumbu wrote: On Thursday, 26 March 2015 at 16:46:06 UTC, Belly wrote: No, wait, the first code is even better because it uses the headers so I don't need to declare the API myself and it uses the MAX_COMPUTERNAME_LENGTH define, too, nice! Using

Re: Problem overloading operator for a struct with an immutable member

2015-03-26 Thread ketmar via Digitalmars-d-learn
On Thu, 26 Mar 2015 05:44:13 +, Jean pierre wrote: auto i = s++; // OUCH, but we expect S.i... but why one expecting `i` here? there IS `opUnary` overload, and `++` corretly transformed to prefix form. there is simply NO postfix form in semantically analyzed code, *all* postfix