On Friday, 11 January 2019 at 14:46:36 UTC, Andrey wrote:
Hi,
In C++ you can create a fixed array on stack:
int count = getCount();
int myarray[count];
In D the "count" is part of type and must be known at CT but in
example it is RT.
How to do such thing in D? Without using of heap.
You co
On Thursday, 10 May 2018 at 20:38:12 UTC, Vladimir Panteleev
wrote:
On Thursday, 10 May 2018 at 20:32:11 UTC, Dgame wrote:
immutable size_t len = s1.length + s2.length;
percent = (len - distance) * 100.0 / len;
Note that this formula will give you only 50% similarity for
"abc" and "de
On Thursday, 10 May 2018 at 20:13:49 UTC, Vladimir Panteleev
wrote:
On Thursday, 10 May 2018 at 20:08:04 UTC, Dgame wrote:
void similar_text_similar_str(char* txt1, size_t len1, char*
That looks like an implementation of Levenshtein distance. We
have one in Phobos:
https://dlang.org/library
I'm in need for some sort of string similarity comparision. I've
found soundex but that didn't solved my needs. After some search
I found a C implementation of similar_text, but that is quite
ugly... I was able to let it work in D but it's still somewhat
messy. Is there any D implementation of
It's really fun playing around:
char[int.max - 1] c;
results in
Internal error: dmd/backend/cgcod.c 634
with DMD 2.079. Guess I or somebody else should report this.
On Monday, 23 April 2018 at 13:48:07 UTC, Steven Schveighoffer
wrote:
On 4/23/18 9:32 AM, Dgame wrote:
char[-1] c;
results in
Error: char[18446744073709551615LU] size 1 *
18446744073709551615 exceeds 0x7fff size limit for static
array
Should we fix that? A negative index should be IMO
char[-1] c;
results in
Error: char[18446744073709551615LU] size 1 * 18446744073709551615
exceeds 0x7fff size limit for static array
Should we fix that? A negative index should be IMO detected
sooner/with a cleaner error message.
On Tuesday, 17 April 2018 at 11:38:17 UTC, Jonathan M Davis wrote:
On Sunday, April 15, 2018 17:59:01 Dgame via
Digitalmars-d-learn wrote:
How am I supposed to insert a struct with immutable members
into an assoc. array?
Reduced example:
struct A {
immutable string name;
}
A[string
On Tuesday, 17 April 2018 at 11:01:21 UTC, Nicholas Wilson wrote:
On Tuesday, 17 April 2018 at 10:17:56 UTC, Dgame wrote:
Ah, I found the msvcEnv.bat and I told me that I have to VSC
installation. Solved!
You should also be able to use -link-internally /LLMV's lld if
you don't want to install
On Tuesday, 17 April 2018 at 09:42:01 UTC, Dgame wrote:
I'm trying to use Ldc on Windows, but I get these linker errors:
OPTLINK (R) for Win32 Release 8.00.17
Copyright (C) Digital Mars 1989-2013 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Warning 9: Unknown
I'm trying to use Ldc on Windows, but I get these linker errors:
OPTLINK (R) for Win32 Release 8.00.17
Copyright (C) Digital Mars 1989-2013 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Warning 9: Unknown Option : OUT
OPTLINK : Warning 9: Unknown Option : LIBPA
How am I supposed to insert a struct with immutable members into
an assoc. array?
Reduced example:
struct A {
immutable string name;
}
A[string] as;
as["a"] = A("a"); // Does not work
On Wednesday, 10 January 2018 at 14:41:21 UTC, Steven
Schveighoffer wrote:
On 1/10/18 3:08 AM, Dgame wrote:
On Wednesday, 10 January 2018 at 01:56:02 UTC, Steven
Schveighoffer wrote:
But current auto ref is what we have, so I would recommend
using it.
I would recommend to ignore auto ref for
On Wednesday, 10 January 2018 at 01:56:02 UTC, Steven
Schveighoffer wrote:
But current auto ref is what we have, so I would recommend
using it.
I would recommend to ignore auto ref for rvalue references. It
generates 2^N functions where N is the amount of auto ref
parameters. That the most aw
On Tuesday, 19 December 2017 at 15:19:53 UTC, Marc wrote:
On Tuesday, 19 December 2017 at 00:01:00 UTC, Ali Çehreli wrote:
On 12/18/2017 03:54 PM, Ali Çehreli wrote:
On 12/18/2017 02:58 PM, Marc wrote:
Here's another experiment:
template FirstOf(T...) {
template otherwise(D) {
st
On Wednesday, 6 December 2017 at 09:25:20 UTC, Biotronic wrote:
On Wednesday, 6 December 2017 at 08:59:09 UTC, Fredrik Boulund
wrote:
string word = "longword";
writeln(sort(word));
But that doesn't work because I guess a string is not the type
of range required for sort?
Yeah, narrow (non-UT
On Friday, 13 October 2017 at 12:08:00 UTC, Jack Applegame wrote:
On Friday, 13 October 2017 at 12:03:55 UTC, Dgame wrote:
Interesting. If you remove the CTor in Foo it works again.
If you remove DTor it works again too. :)
That's one of these times where it would be helpful to see the
gener
On Friday, 13 October 2017 at 10:35:56 UTC, Jack Applegame wrote:
If you don't want to get the great PITA, never create temporary
objects in function parameters.
I recently spent a whole day digging through my reference
counted containers library. But nasty bug was not there, but in
the compile
On Monday, 24 July 2017 at 18:15:20 UTC, Steven Schveighoffer
wrote:
On 7/24/17 1:29 PM, Dgame wrote:
Why isn't the compiler able to deduce S[] => I[]? Or is it
just me?
I've tried dmd 2.075
I know you got the explanation already, but just in case you
actually need to call something like te
On Monday, 24 July 2017 at 17:33:48 UTC, Adam D. Ruppe wrote:
On Monday, 24 July 2017 at 17:29:55 UTC, Dgame wrote:
S[] ss = [new S()];
test1(ss); // Fails
Why isn't the compiler able to deduce S[] => I[]? Or is it
just me?
This is exactly because of polymorphism. Consider th
I may be just tired, but could somebody explain this behaviour to
me? It seems odd to me:
interface I
{
}
class S : I
{
}
void test1(I[])
{
}
void test2(I)
{
}
void main()
{
test1([new S()]); // Works
test2(new S()); // Works
I i = new S();
test2
On Tuesday, 11 July 2017 at 08:23:02 UTC, Miguel L wrote:
I need to create a non-dynamic array like this
void f(int x)
{
int[x] my_array;
...
this does not compile as x value needs to be known at compile
time. The closest to this I can get is:
void f(int x)
{
int[] my_array;
my_array.length=
22 matches
Mail list logo