Re: How to use a char[] buffer in D

2016-06-23 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jun 23, 2016 at 08:36:57AM -0700, H. S. Teoh via Digitalmars-d-learn wrote: > On Thu, Jun 23, 2016 at 10:00:33AM -0400, Steven Schveighoffer via > Digitalmars-d-learn wrote: [...] > > > On Wednesday, 22 June 2016 at 22:41:24 UTC, H. S. Teoh wrote: [...] > > > > Maybe try: > > > > > > >

Re: How to use a char[] buffer in D

2016-06-23 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jun 23, 2016 at 10:00:33AM -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: > On 6/23/16 1:59 AM, Andrew Chapman wrote: > > Perfect, thank you! :-) Works like a charm. > > > > On Wednesday, 22 June 2016 at 22:41:24 UTC, H. S. Teoh wrote: > > > On Wed, Jun 22, 2016 at 09:57:04PM

Re: How to use a char[] buffer in D

2016-06-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/23/16 1:59 AM, Andrew Chapman wrote: Perfect, thank you! :-) Works like a charm. On Wednesday, 22 June 2016 at 22:41:24 UTC, H. S. Teoh wrote: On Wed, Jun 22, 2016 at 09:57:04PM +, Andrew Chapman via Digitalmars-d-learn wrote: Maybe try: if (buffer[] in myHash) { ... } ?

Re: How to use a char[] buffer in D

2016-06-23 Thread Rene Zwanenburg via Digitalmars-d-learn
On Thursday, 23 June 2016 at 05:59:10 UTC, Andrew Chapman wrote: Perfect, thank you! :-) Works like a charm. On Wednesday, 22 June 2016 at 22:41:24 UTC, H. S. Teoh wrote: On Wed, Jun 22, 2016 at 09:57:04PM +, Andrew Chapman via Digitalmars-d-learn wrote: Maybe try: if (buffer[]

Re: How to use a char[] buffer in D

2016-06-23 Thread Andrew Chapman via Digitalmars-d-learn
Perfect, thank you! :-) Works like a charm. On Wednesday, 22 June 2016 at 22:41:24 UTC, H. S. Teoh wrote: On Wed, Jun 22, 2016 at 09:57:04PM +, Andrew Chapman via Digitalmars-d-learn wrote: Maybe try: if (buffer[] in myHash) { ... } ? Does that make a difference? T

Re: How to use a char[] buffer in D

2016-06-22 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jun 22, 2016 at 09:57:04PM +, Andrew Chapman via Digitalmars-d-learn wrote: > Hi everyone, just wanting some help with optimisation if anyone is > kind enough :-) > > I have a loop that iterates potentially millions of times, and inside > that loop I have code that appends some

Re: How to use a char[] buffer in D

2016-06-22 Thread Ali Çehreli via Digitalmars-d-learn
On 06/22/2016 02:57 PM, Andrew Chapman wrote: > Code such as: > > if(buffer in myHash) { > > } > > throws an access violation. A string value works without error. Does it throw an exception? Can you reproduce the issue with a short program? Ali

How to use a char[] buffer in D

2016-06-22 Thread Andrew Chapman via Digitalmars-d-learn
Hi everyone, just wanting some help with optimisation if anyone is kind enough :-) I have a loop that iterates potentially millions of times, and inside that loop I have code that appends some strings together, e.g.: string key = s1 ~ "_" ~ s2; I discovered that due to the memory