Re: isRvalue trait

2016-10-10 Thread Nordlöw via Digitalmars-d-learn
On Monday, 10 October 2016 at 11:51:09 UTC, Nordlöw wrote: Found it: http://forum.dlang.org/post/n8m8bh$2vgc$1...@digitalmars.com https://issues.dlang.org/show_bug.cgi?id=15634 Ok, so I added `isLvalue` and `isRvalue` to https://github.com/nordlow/phobos-next/blob/master/src/moval.d Now the

Re: When to call GC.{add,remove}Range in containers?

2016-10-10 Thread Nordlöw via Digitalmars-d-learn
On Monday, 10 October 2016 at 08:26:45 UTC, Kagamin wrote: On Monday, 10 October 2016 at 07:12:10 UTC, Nordlöw wrote: should not be scanned by the GC. Shouldn't be a problem. What do you mean? I'm talking about an optimization; don't call addRange when we don't need to, because the

isRvalue trait

2016-10-10 Thread Nordlöw via Digitalmars-d-learn
At https://github.com/nordlow/phobos-next/blob/master/src/moval.d I've implemented a helper function for creating r-value out of l-values defined as E movedToRvalue(E)(ref E e) { import std.algorithm.mutation : move; E value; move(e, value); // this can be optimized

Re: isRvalue trait

2016-10-10 Thread Nordlöw via Digitalmars-d-learn
On Monday, 10 October 2016 at 11:46:01 UTC, Nordlöw wrote: Is there one? Found it: http://forum.dlang.org/post/n8m8bh$2vgc$1...@digitalmars.com https://issues.dlang.org/show_bug.cgi?id=15634

Re: isRvalue trait

2016-10-10 Thread Marc Schütz via Digitalmars-d-learn
On Monday, 10 October 2016 at 11:46:01 UTC, Nordlöw wrote: At https://github.com/nordlow/phobos-next/blob/master/src/moval.d I've implemented a helper function for creating r-value out of l-values defined as E movedToRvalue(E)(ref E e) { import std.algorithm.mutation : move; E

How to correctly display accented characters at the Windows prompt?

2016-10-10 Thread Cleverson Casarin Uliana via Digitalmars-d-learn
Hello, when I run a compiled Windows executable at the console, letters outside the ascii range such as ç and ã do not display propperly. Is there any d function to change the console code page on the fly? My Windows console code page, which is for Brazilian Portuguese, is at 850. Perhaps an

Re: Why can't static arrays be sorted?

2016-10-10 Thread TheGag96 via Digitalmars-d-learn
On Saturday, 8 October 2016 at 21:14:43 UTC, Jon Degenhardt wrote: This distinction is a bit on the nuanced side. Is it behaving as it should? --Jon I think so? It's not being modified in the second case because the array is being passed by value... "x" there is a reference to an element

Re: How to correctly display accented characters at the Windows prompt?

2016-10-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, October 10, 2016 13:24:09 Cleverson Casarin Uliana via Digitalmars- d-learn wrote: > Hello John and all, how do you search for a given function to see > where it is defined/declared? I tried to find SetConsoleOutputCP by > myself, but the search embeded in the documentation cannot find

Re: Why can't static arrays be sorted?

2016-10-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, October 10, 2016 16:29:41 TheGag96 via Digitalmars-d-learn wrote: > On Saturday, 8 October 2016 at 21:14:43 UTC, Jon Degenhardt wrote: > > This distinction is a bit on the nuanced side. Is it behaving > > as it should? > > > > --Jon > > I think so? It's not being modified in the second

Re: How to correctly display accented characters at the Windows prompt?

2016-10-10 Thread Martin Krejcirik via Digitalmars-d-learn
Thanks, Cleverson Call SetConsoleOutputCP(CP_UTF8). No, this may appear to to work, but in reality, it's broken. The only reliable way is to convert to the native windows codepage.

ptrdiff_t of class.tupleof entry

2016-10-10 Thread Satoshi via Digitalmars-d-learn
Hello, How can I take an ptrdiff_t of any tupleoff entry from class during compilation? I need something like this: template Test(T, int i) { enum Test = [i] - [0]; } and then use it like: class AnyClass { int a; int b; int c; string d; } enum Addr = Test!(AnyClass, 3); void

Re: ptrdiff_t of class.tupleof entry

2016-10-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, October 10, 2016 17:57:15 Satoshi via Digitalmars-d-learn wrote: > Hello, > How can I take an ptrdiff_t of any tupleoff entry from class > during compilation? > > > I need something like this: > > template Test(T, int i) { > enum Test = [i] - [0]; > } > > > and then use it like: > >

Re: Easy sockets - don't exist yet?

2016-10-10 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Monday, 10 October 2016 at 02:54:09 UTC, Jonathan M Davis wrote: On Monday, October 10, 2016 01:43:54 Konstantin Kutsevalov via So, it's simply gone. But if someone wants to propose a replacement, they're certainly still free to do so. - Jonathan M Davis I see, thank you for answer

Re: Easy sockets - don't exist yet?

2016-10-10 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Monday, 10 October 2016 at 07:37:48 UTC, Bauss wrote: Wrote some pretty simple sockets that you could use (Based on vibe.d though.) https://github.com/bausshf/cheetah Hi, Yes I saw it, but not sure. Does it make sense to use vibe.d only for sockets. I mean, it like a web framework with

Re: isRvalue trait

2016-10-10 Thread Nordlöw via Digitalmars-d-learn
On Monday, 10 October 2016 at 12:22:54 UTC, Marc Schütz wrote: I would like to overload to an identity op. If the compiler is smart enough to understand what `moveEmplace()` does, it could already do this automatically. Doh! My mistake. I'll use `moveEmplace`, then. Thx!

Re: How to correctly display accented characters at the Windows prompt?

2016-10-10 Thread Martin Krejcirik via Digitalmars-d-learn
On Monday, 10 October 2016 at 19:31:14 UTC, Cleverson Casarin Uliana wrote: Hi Martin, indeed, here in my workplace Windows machine there is no "CP_UTF_8" codepage, nor there is 65001. I was waiting to codepage 65001 (UTF8) should be available on all modern Windows. You can try command cp

Re: opIndexDispatch?

2016-10-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, October 10, 2016 19:01:19 Yuxuan Shui via Digitalmars-d-learn wrote: > Hi, > > Why is there no opIndexDispatch for overloading a[x].func() ? There's opIndex for overloading a[x], and then you can call a function on the return value. If you want some kind of opDispatch on the return

opIndexDispatch?

2016-10-10 Thread Yuxuan Shui via Digitalmars-d-learn
Hi, Why is there no opIndexDispatch for overloading a[x].func() ?

Re: How to correctly display accented characters at the Windows prompt?

2016-10-10 Thread Cleverson Casarin Uliana via Digitalmars-d-learn
Hi Martin, indeed, here in my workplace Windows machine there is no "CP_UTF_8" codepage, nor there is 65001. I was waiting to try it later on my home machine, but since you say it's broken, then I'll need to look for a way to convert the actual string to the 850 codepage... Just for info, this is

Re: How to correctly display accented characters at the Windows prompt?

2016-10-10 Thread Martin Krejcirik via Digitalmars-d-learn
Windows. You can try command cp 65001 in the console window chcp 65001

Re: MemberDefaults trait

2016-10-10 Thread Ali Çehreli via Digitalmars-d-learn
On 10/10/2016 04:50 PM, Ali Çehreli wrote: > static if (!is(T == struct)) { > static assert(T.stringof ~ " is not a struct type"); > } Wow! That's a nice brain fart on my part. Ok, I can fix that one... :) Ali

Re: How to correctly display accented characters at the Windows prompt?

2016-10-10 Thread Cleverson Casarin Uliana via Digitalmars-d-learn
Hello John and all, how do you search for a given function to see where it is defined/declared? I tried to find SetConsoleOutputCP by myself, but the search embeded in the documentation cannot find anything in the phobos library refference, and searching the entire site returns forum posts only.

Re: Current State of the GC?

2016-10-10 Thread rikki cattermole via Digitalmars-d-learn
On 11/10/2016 10:12 AM, Martin Lundgren wrote: I've been reading up a bit on the D garbage collector. Seen mostly negative things about it. I've also seen a lot of proposals and what not, but not much about the current state of things. The latest page I can find about it is 2015H1. It mentions

Re: Easy sockets - don't exist yet?

2016-10-10 Thread Bauss via Digitalmars-d-learn
Wrote some pretty simple sockets that you could use (Based on vibe.d though.) https://github.com/bausshf/cheetah

Re: Problems with "shared"

2016-10-10 Thread Satoshi via Digitalmars-d-learn
On Sunday, 9 October 2016 at 21:32:23 UTC, ag0aep6g wrote: On 10/09/2016 10:57 PM, jython234 wrote: 1. Where do I use the "shared" keyword? What doesn't work is creating an unshared object of a class that only has a shared constructor. To create both shared and unshared objects, you need

Re: dub command line in config?

2016-10-10 Thread Seb via Digitalmars-d-learn
On Sunday, 9 October 2016 at 20:03:58 UTC, WhatMeWorry wrote: On Sunday, 9 October 2016 at 19:11:52 UTC, Jinx wrote: On Sunday, 9 October 2016 at 08:52:55 UTC, rikki cattermole wrote: On 09/10/2016 9:17 PM, Jinx wrote: [...] That is enough. Mike Parker has presented a workaround that you

When to call GC.{add,remove}Range in containers?

2016-10-10 Thread Nordlöw via Digitalmars-d-learn
Which std.trait should be used to statically check whether I should call GC.{add,remove}Range on the elements of D containers? `std.container.array.Array` currently uses `hasIndirections` but a comment on the same line says it should use `hasPointers` instead. containers-em uses template

Re: When to call GC.{add,remove}Range in containers?

2016-10-10 Thread Kagamin via Digitalmars-d-learn
On Monday, 10 October 2016 at 07:12:10 UTC, Nordlöw wrote: should not be scanned by the GC. Shouldn't be a problem.

MemberDefaults trait

2016-10-10 Thread Ali Çehreli via Digitalmars-d-learn
Could you please review the following template to see whether it makes sense. It produces an AliasSeq type consisting of the default values of the members of a struct. It should and does support members that are initialized with '= void'. I could not achieve this with std.traits or __traits.

passing static arrays to each! with a ref param [Re: Why can't static arrays be sorted?]

2016-10-10 Thread Jon Degenhardt via Digitalmars-d-learn
On Monday, 10 October 2016 at 16:46:55 UTC, Jonathan M Davis wrote: On Monday, October 10, 2016 16:29:41 TheGag96 via Digitalmars-d-learn wrote: On Saturday, 8 October 2016 at 21:14:43 UTC, Jon Degenhardt wrote: > This distinction is a bit on the nuanced side. Is it > behaving as it should? >

Re: How do I load a shared library?

2016-10-10 Thread Nafees via Digitalmars-d-learn
Fixed this issue, stackoverflow helped http://stackoverflow.com/questions/39929495 just compiled the library with -fPIC -m32 -shared

Re: How do I load a shared library?

2016-10-10 Thread Nafees via Digitalmars-d-learn
anyone? so there is no way to get my 50,000 Line of code to work again? All that code to waste? P.S: I've tried doing these: Tried to use GDC, no luck used -defaultlib=libphobos2.so, no luck removed all functions from library, compiled it empty, yet, dlopen gives segFault. AND: This same

Re: weighted round robin

2016-10-10 Thread Marc Schütz via Digitalmars-d-learn
On Saturday, 8 October 2016 at 22:48:53 UTC, vino wrote: Hi, Can some one guide me on how to implement the weighted round robin, below is what i tried or any other better ways to do it Main Requirement : Incoming socket connection has to be sent to 3 servers in the weighted round robin

Re: How to correctly display accented characters at the Windows prompt?

2016-10-10 Thread John C via Digitalmars-d-learn
On Monday, 10 October 2016 at 14:14:08 UTC, Cleverson Casarin Uliana wrote: Hello, when I run a compiled Windows executable at the console, letters outside the ascii range such as ç and ã do not display propperly. Is there any d function to change the console code page on the fly? My Windows