I'm not sure whether or not I've encountered a bug or whether my
understanding of scoped imports is just faulty.
blah.d:
1 module blah;
2
3 version(A)
4 {
5import std.range;
6 }
7
8 struct Blah(R)
9 {
10version(B)
11{
12 import std.range;
13}
14s
What is the recommended way to compare substrings (even of one character
long)?
I was wondering whetherI'm missing something when doing [1]:
!(cast(string)myString[0..1] == ">"
?
BR
// Samuel
[1] Longer context:
string sequence = "";
File file = File("some_file_with_dna_sequences.txt","r")
On 05/09/2013 05:59 AM, Samuel Lampa wrote:
What is the recommended way to compare substrings (even of one
character long)?
Ah, had already got the answer :) (but too long since I played with D
last time ... :") ):
http://stackoverflow.com/questions/14113470/check-if-string-starts-with-a-sub
On Thursday, 9 May 2013 at 00:10:48 UTC, Byron Heads wrote:
I have a variant associative array. In the example below I am
wondering
if there is a way to create the array without having to
indicate the
variant type on all of the values. Would like to be able to
write code
like #2, or something
I tried defining opAdd for S as following:
auto opAdd(alias rhs)()
if (is(typeof(rhs) == S))
{
return Test!(n + rhs.n);
}
Which I know is kind of silly, since I can't use opAdd to do a +
b anymore, but it fails to compile anyway. The compiler says that
b (of type Test) does not match a's v
On Wednesday, 8 May 2013 at 13:01:52 UTC, evilrat wrote:
On Wednesday, 8 May 2013 at 09:43:43 UTC, Mike Parker wrote:
On Wednesday, 8 May 2013 at 09:37:51 UTC, KillerSponge wrote:
Hi all,
I've been searching around for physics libraries to use in a
real-time 3D application (a game, to be more
Byron Heads:
I have a variant associative array. In the example below I am
wondering
if there is a way to create the array without having to
indicate the
variant type on all of the values. Would like to be able to
write code
like #2, or something cleaner/better for #1.
...
// #1 This
On Thu, May 09, 2013 at 01:11:00AM +0200, Carl wrote:
> Wow, I feel silly.
>
> In the process of making sample code I found the problem: I have
> been reading the output with a text editor instead of a hex editor.
> To think I spent hours on this problem... *face palm*
[...]
No need to be embarra
I have a variant associative array. In the example below I am wondering
if there is a way to create the array without having to indicate the
variant type on all of the values. Would like to be able to write code
like #2, or something cleaner/better for #1. This is intended for a
library. Othe
On Wednesday, 8 May 2013 at 21:34:00 UTC, Carl wrote:
I am learning D so I thought this would be the correct place
for this question (I assume I am making an error, not the
compiler).
I am writing arrays of ubytes using rawWrite to a file.
Whenever I write arrays full of numbers I have no pro
Wow, I feel silly.
In the process of making sample code I found the problem: I have
been reading the output with a text editor instead of a hex
editor. To think I spent hours on this problem... *face palm*
Thanks for your quick replies.
On 05/08/2013 02:46 PM, Meta wrote:
>> For example:
>> ubyte[] data = [5, 34, 9, 45];
>> file.rawWrite(data); // OKAY
>>
>> ubyte[] data = [0, 0, 0, 45];
>> file.rawWrite(data); // NOT OKAY
>
> Since ubytes are pretty much the same as chars,
True from the point of view of sizes: they are both 8-
For example:
ubyte[] data = [5, 34, 9, 45];
file.rawWrite(data); // OKAY
ubyte[] data = [0, 0, 0, 45];
file.rawWrite(data); // NOT OKAY
Since ubytes are pretty much the same as chars, I think writing 0
to the file will actually write the null character, which
probably isn't a good thing.
I am learning D so I thought this would be the correct place for
this question (I assume I am making an error, not the compiler).
I am writing arrays of ubytes using rawWrite to a file. Whenever
I write arrays full of numbers I have no problems, but once I
write an array with zeroes I can then
Changed compilers from dmd 2.060 to dmd 2.062, running on Windows
7. Got a couple of errors relating to imports that I fixed but
now it crashes with no indication of what went wrong. A Windows
message dialog pops up stating that dmd.exe has stopped working.
The "details" are posted below.
The
On Wed, 08 May 2013 08:28:50 -0400, Matic Kukovec
wrote:
Thanks for the explanation Steve.
Can you please give me a correct example of:
- creating a dynamic string array
auto arr = new char[N];
N can be a runtime value.
- looping over it and adding values
Not sure what you mean here.
On Wednesday, 8 May 2013 at 09:43:43 UTC, Mike Parker wrote:
On Wednesday, 8 May 2013 at 09:37:51 UTC, KillerSponge wrote:
Hi all,
I've been searching around for physics libraries to use in a
real-time 3D application (a game, to be more precise). I know
that Bullet and ODE are the big open so
On Tuesday, 7 May 2013 at 15:05:40 UTC, Meta wrote:
This is a little test to see if I can wrap types in structs and
do some checking at compile time. For example, statically
verifying in opAdd that neither number being added is negative.
I
added in the pragma to see what T's type is because I h
On Wednesday, 8 May 2013 at 12:03:08 UTC, Steven Schveighoffer
wrote:
On Wed, 08 May 2013 06:20:45 -0400, Matic Kukovec
wrote:
Was playing around with the code and found that this WORKS:
(note the "app_temp_array.reserve(5000);" at the top,
without this line it doesn't work)
[snip]
T
On Wed, 08 May 2013 06:20:45 -0400, Matic Kukovec
wrote:
Was playing around with the code and found that this WORKS:
(note the "app_temp_array.reserve(5000);" at the top, without this
line it doesn't work)
[snip]
The memory usage shrinks from 400MB to 2MB, which is right!
Why?
Thi
Was playing around with the code and found that this WORKS:
(note the "app_temp_array.reserve(5000);" at the top, without
this line it doesn't work)
import std.stdio, core.memory, std.cstream, std.array;
void main()
{
string[] temp_array;
Appender!(string[]) app_temp_array =
On Tuesday, 7 May 2013 at 11:49:07 UTC, evilrat wrote:
On Tuesday, 7 May 2013 at 10:58:42 UTC, John Colvin wrote:
...
int a[];
please don't use C style declarations, D style is "type
followed by id":
int[] a;
woops, just copied it from the original post.
On Wednesday, 8 May 2013 at 09:37:51 UTC, KillerSponge wrote:
Hi all,
I've been searching around for physics libraries to use in a
real-time 3D application (a game, to be more precise). I know
that Bullet and ODE are the big open source ones for C/C++, and
I get the general impression that Bu
On Wednesday, 8 May 2013 at 08:59:57 UTC, Minas Mina wrote:
On Tuesday, 7 May 2013 at 23:09:29 UTC, Matic Kukovec wrote:
Hi
I'm running Windows Vista 64 with dmd 2.062.
I have a simple program:
import std.stdio, core.memory, std.cstream;
void main()
{
string[] temp_array;
for
On Tuesday, 7 May 2013 at 23:09:29 UTC, Matic Kukovec wrote:
Hi
I'm running Windows Vista 64 with dmd 2.062.
I have a simple program:
import std.stdio, core.memory, std.cstream;
void main()
{
string[] temp_array;
for(int i=0;i<500;i++)
{
++temp_arra
Thanks you guys for all the suggestions.
bearophile:
I am not creating 64 bit binaries. Tried compiling with or
without the "-m32" flag.
I have played around with GC.free, see below for more details.
Juan Manuel Cabo:
I tried your methods, but no change.
The original program I described earlie
26 matches
Mail list logo