On Monday, 21 March 2022 at 10:29:53 UTC, Alexandru Ermicioi
wrote:
On Friday, 18 March 2022 at 21:04:03 UTC, H. S. Teoh wrote:
On Fri, Mar 18, 2022 at 11:16:51AM -0700, Ali Çehreli via
Digitalmars-d-learn wrote:
tldr; I am talking on a soap box with a big question mind
hovering over on my head
On Monday, 21 March 2022 at 09:25:56 UTC, Dadoum wrote:
On Friday, 18 March 2022 at 04:13:36 UTC, Alain De Vos wrote:
Dlang includes some good ideas.
But dub pulls in so much stuff. Too much for me.
I like things which are clean,lean,little,small.
But when i use dub it links with so many librari
On Friday, 18 March 2022 at 04:13:36 UTC, Alain De Vos wrote:
Dlang includes some good ideas.
But dub pulls in so much stuff. Too much for me.
I like things which are clean,lean,little,small.
But when i use dub it links with so many libraries.
Are they really needed ?
And how do you compare to py
On Wednesday, 29 December 2021 at 10:21:07 UTC, Stanislav Blinov
wrote:
On Wednesday, 29 December 2021 at 10:14:13 UTC, Tobias Pankrath
wrote:
How do I mixin a function only if it is not already present?
Perhaps use opDispatch?
That's a great idea and I'll look into it.
I am trying to implement the builder pattern for some structs.
Currently I am auto implementing all methods by mixing them into
the builder, but now I need some custom logic for some of the
fields and I figured I just write them down by hand and mixin the
rest.
I tried checking if it is conta
On Tuesday, 28 December 2021 at 21:19:29 UTC, rempas wrote:
I would like to know if that's possible. Actually I would like
to do something like the following:
```
extern (C) void main() {
void print_num(int num, comp_time_type int mul) {
static if (is(mul == ten)) {
printf("%d\n", n
On Sunday, 2 May 2021 at 07:38:03 UTC, Tobias Pankrath wrote:
For your convenience: https://run.dlang.io/is/gHSlu1
I am using Refcounted() because HashMap itself is not
copy-able. Is there another way to have HashMaps as values of
HashMaps?
I've figured it out and filed an PR
https://githu
On Sunday, 2 May 2021 at 08:59:15 UTC, Imperatorn wrote:
```d
HashMap!(int, RefCounted!Map) mapOfMaps = HashMap!(int,
RefCounted!Map)(1024);
```
That only fixes it, because you are avoiding the rehash with the
initial size.
On Sunday, 2 May 2021 at 08:59:15 UTC, Imperatorn wrote:
On Sunday, 2 May 2021 at 07:38:03 UTC, Tobias Pankrath wrote:
```d
HashMap!(int, RefCounted!Map) mapOfMaps = HashMap!(int,
RefCounted!Map)(1024);
```
Is HashMap.init a broken state? That makes using them hard as
struct members :/
The following code segfaults, when the outer hashmap rehashes,
and I am not yet sure why.
```d
module tests.refcounted_hashmap_test;
import containers;
import std.typecons;
struct Map
{
HashMap!(int, int) theMap;
}
unittest
{
HashMap!(int, RefCounted!Map) mapOfMaps;
foreach (i; 0 .
On Tuesday, 13 April 2021 at 12:30:13 UTC, tchaloupka wrote:
Some kind of GC memory dump and analyzer tool as mentioned
`Diamond` would be of tremendous help to diagnose this..
You could try to get the stack traces of the allocating calls via
eBPF. Maybe that leads to some new insights.
On Thursday, 18 March 2021 at 02:28:56 UTC, Chris Piker wrote:
Hi D
I've started a D layer for one of my C libraries that's adds
some new functionality and a bit of an interface upgrade. In
turn I'm using this combined code-base as a dependency for D
"scripts". Since my software is used by
On Wednesday, 17 March 2021 at 19:33:26 UTC, Chris Piker wrote:
So, if I could do the equivalent of:
dub add-path
via an environment variable (not a permanent change under
~/.dub), or have some environment variable that tells dub where
to read a "system-level" local-packages.json file and m
On Saturday, 12 December 2020 at 18:14:31 UTC, Paul Backus wrote:
Functions from different mixin templates can't overload each
other. The reason for this is that, when you mix in a mixin
template, it does not *actually* add the declarations inside it
to a current scope: instead, it adds them to
I want to wrap e.g. an int and implement basic arithmetic. In the
provided example [1] I use two mixin templates to separately
implement scaling (multiplication with int/double) and addition
and subtraction with the type itself.
In the end I want to have several distinct wrappers and allow
s
On Saturday, 12 December 2020 at 12:03:49 UTC, kdevel wrote:
I don't have a suggestion for better wording yet.
[1] https://dlang.org/phobos/std_regex.html
This [1] is how I would word it.
[1] https://github.com/dlang/phobos/pull/7724
On Saturday, 12 December 2020 at 12:03:49 UTC, kdevel wrote:
In some situations a ] must be escaped as in
auto re = regex(`^[a\]]$`); // match a and ] only
Unfortunately dmd/phobos does not warn if you forget the
backslash:
auto re = regex(`^[a]]$`); // match a]
This leads me to the d
On Saturday, 12 December 2020 at 12:18:47 UTC, Andre Pany wrote:
In any case you should have configurations in your dub json.
Thank you for your detailed reply and I am sure I can make it
work in the way you described.
But I don't think my use case is invalid and dub should improve
its usa
Whenever I come back to some D, I seem to be stumbling over dub.
Somehow dub and I don't align:
$ dub init dubtest && cd dubtest
$ dub test
-> creates executable `dubtest` (saying Falling back to "dub -b
unittest".)
$ touch source/lib.d
dub test
-> creates executable dubtest-test-library
Que
On Saturday, 12 December 2020 at 09:05:19 UTC, Godnyx wrote:
I'm trying to create a cool function that will let us do
formatting sorter and faster. The function will work like that:
outln("My name is {name} and my age is {age}");
this will be equivalent to:
writeln("My name is ", name, " and
On Wednesday, 25 December 2019 at 12:39:08 UTC, BoQsc wrote:
Are there any other ways to join two strings without Tilde ~
character?
I can't seems to find anything about Tilde character
concatenation easily, nor the alternatives to it. Can someone
share some knowledge on this or at least point
On Saturday, 14 December 2019 at 10:32:10 UTC, berni44 wrote:
On Saturday, 14 December 2019 at 09:33:13 UTC, Tobias Pankrath
wrote:
See: https://dlang.org/spec/lex.html#integerliteral
What I am aiming at: Is the spec wrong or am I
misunderstanding it and did this change recently?
You are rig
On Saturday, 14 December 2019 at 07:44:37 UTC, berni44 wrote:
On Saturday, 14 December 2019 at 07:09:30 UTC, Tobias Pankrath
wrote:
void main()
{
auto x = 9223372036854775808; // long.max + 1
}
You need to tell, that this is an unsigned long literal, else
the compiler treats it as an int:
void main()
{
auto x = 9223372036854775808; // long.max + 1
}
onlineapp.d(3): Error: signed integer overflow
According to spec x should be of type ulong and this should
compile? It indeed compiles if I add the uL postfix.
Is this a bug or indented behaviour?
Hi,
I wanted to hack a bit on phobos and wondered what the best way
is to use my own version in a project managed by dub.
I have used the dlang/tools/setup.sh and got ../d/dmd,
../d/phobos/ ../d/druntime etc. Now I want to hack on phobos and
use that version in a project of mine to test the
Why does the following not work? It works, if I move the 'prop'
out of 'foo'.
---
struct S {
ubyte[12] bar;
}
bool foo (ref S s)
{
static bool prop(const(ubyte)[] f) {
return f.length > 1;
}
return s.bar[].prop;
}
---
Thanks!
On Friday, 1 November 2019 at 09:17:03 UTC, Dennis wrote:
Template constraints are not allowed before the signature in
the language, so it can be expected the documentation does not
swap that order.
On Thursday, 31 October 2019 at 13:34:35 UTC, Tobias Pankrath
wrote:
I was confused at first
e.g. here: https://dlang.org/library/object/destroy.html
I was confused at first by the trailing
if (!is(T == struct) && !is(T == interface) && !is(T == class)
&& !__traits(isStaticArray, T));
after I somehow managed to completely parse that page without
recognizing all other constraints.
On Thursday, 31 October 2019 at 12:37:55 UTC, user1234 wrote:
struct S
{
S*[] children;
}
because otherwise when you declare the array the compiler has
not finished the semantic ana of S.
---
struct Test
{
Test[] t;
}
---
Works today. Putting pointers into the container (and thus ha
My Problem:
--- (https://run.dlang.io/is/CfLscj)
import std.container.array;
import std.traits;
struct Test
{
Test[] t;
}
struct Test2
{
Array!Test2 t;
}
int main()
{
return FieldTypeTuple!Test.length + FieldTypeTuple!Test2;
}
---
I've found https://issues.dlang.org/show_bug.cgi
On Friday, 11 October 2019 at 14:43:49 UTC, Just Dave wrote:
I come from both a C++ and C# background. Those have been the
primary languages I have used.
Probably the D templates relate to C# generics the same way that
C++ templates do.
On Wednesday, 9 October 2019 at 18:57:01 UTC, SrMordred wrote:
https://garden.dlang.io/
This should be more prominent. Very nice.
On Friday, 4 October 2019 at 10:00:08 UTC, Per Nordlöw wrote:
Is the usage of `enforce` to check for out of bounds (fullness)
idiomatic D or should an `assert()` be used instead?
I'd say it should follow -boundscheck:
https://dlang.org/dmd-linux.html#switch-boundscheck
Does that set an versi
On Wednesday, 25 September 2019 at 17:32:25 UTC, dokutoku wrote:
I wrote the following code to get the address of a class
instance, but it doesn't work.
Please let me know if there is a way to write it to work
properly.
private import std;
```
class C
{
C* this_pointer()
{
On Tuesday, 24 September 2019 at 17:01:46 UTC, Anonymouse wrote:
I want to write a piece of code that reflects on the names of
members of a passed struct, where some are depreacted.
https://run.dlang.io/is/P9EtRG
struct Foo
{
string s;
int ii;
bool bbb;
deprecated("Use `s`")
On Saturday, 21 September 2019 at 09:03:13 UTC, Ron Tarrant wrote:
Ah! Thanks, ag0aep6g. I was wondering about that when I was
writing the code. (If I already knew this, I'd forgotten.) I
did as you suggested, took out all '*' and '&' and it works
perfectly.
Is this what you want?
---
current
Hi,
I've got a dub package with the following configuration file
---
{
"description": "A minimal D application.",
"license": "proprietary",
"authors": [
"me"
],
"copyright": "Copyright © 2019, me",
"name": "test",
"targetType" : "none",
"dependencies": {
"t
Including Phobos? Your posted backtrace looks to me like
templates instantiated within Phobos, so I think you'd need
Phobos with debug symbols for those lines.
---
int main(string[] argv)
{
return argv[1].length > 0;
}
---
~ [i] % rdmd -g -debug test.d
core.exception.RangeError@test.d(3): R
On Tuesday, 31 October 2017 at 11:21:30 UTC, Moritz Maxeiner
wrote:
On Tuesday, 31 October 2017 at 11:04:57 UTC, Tobias Pankrath
wrote:
[...]
??:? pure @safe void
std.exception.bailOut!(Exception).bailOut(immutable(char)[],
ulong, const(char[])) [0xab5c9566]
??:? pure @safe bool std.exception.
Hi,
I'm using ArchLinux and the recent DMD from the Arch repositories
and my backtraces show no line numbers. I now that is an old
issue, but I'm back to D after a long pause and I thought that
this used to work out of the box.
My backtraces look likes this:
??:? pure @safe void
std.except
Greetings,
I need to match any character, except control characters and some
other exceptions and thought this would be a good usecase to use
character classes and set operations.
Can I combine this with unicode properties?, e.g: any Charactor
that is not a control character and not ';' or '
On Sunday, 15 November 2015 at 10:59:43 UTC, Tobias Pankrath
wrote:
Point* p = (allocate memory from somewhere);
emplace!Point(p, 1, 2);
immutable(Point)* immutableP = cast(immutable(Point)*) p;
You could also use the emplace version that takes untyped memory:
http://dlang.org/phobos/std_con
this compiles and runs fine. Because emplace expects a typed
pointer, it actually modifies (*p).x and (*p).y
As far as I understand, this causes undefined behavior.
Are there any (safe) alternatives to this code other than
making the immutable members mutable?
As long as there are no other
or with ~ operator:
import std.stdio;
[...]
Did anyone check that the last loop isn't optimized out? Could
also be improved further if you make the function take an output
range and reuse one appender for every call, but that might be to
far off the original perl solution.
On Tuesday, 10 November 2015 at 10:21:32 UTC, tired_eyes wrote:
Hi,
The only example of string interpolation I've found so far is
on Rosetta Code:
void main() {
import std.stdio, std.string;
"Mary had a %s lamb.".format("little").writeln;
"Mary had a %2$s %1$s lamb.".format("littl
On Wednesday, 14 October 2015 at 14:42:31 UTC, Namal wrote:
Hello,
I don't remember exactly but I think when I first saw D code
there was tree datatype implemented without pointers. Is it
possible to make a tree struct without pointers?
struct Tree {
Tree[] children;
}
That works quite w
On Friday, 17 April 2015 at 10:36:33 UTC, Szymon Gatner wrote:
Hi,
are there equivalents of Interlocked.Exchange [1] and
Interlocked.CompareExchange [2] in D? I can't find it in teh
docs?
[1]
https://msdn.microsoft.com/en-us/library/f2090ex9(v=vs.110).aspx
[2]
https://msdn.microsoft.com/
On Wednesday, 25 March 2015 at 14:40:28 UTC, Per Nordlöw wrote:
On Wednesday, 25 March 2015 at 13:55:29 UTC, bearophile wrote:
Nordlöw:
I have graph traversal algorithm that needs to keep track of
the N "best" node visit.
std.algorithm.topNCopy?
Bye,
bearophile
Notice that, ideally, I wou
On Saturday, 21 March 2015 at 17:48:41 UTC, Craig Dillabaugh
wrote:
Motivated by this thread:
http://forum.dlang.org/thread/measc3$qic$1...@digitalmars.com
I was hoping to see if I could do some work on the Phobos
documentation, but I am curious to know what the easiest way
for someone with l
Now I am totally confused. lazy and eager evaluation are
unrelated to compile time and run time.
On Friday, 20 March 2015 at 12:15:22 UTC, Dennis Ritchie wrote:
On Friday, 20 March 2015 at 10:38:17 UTC, John Colvin wrote:
I don't understand what you mean. You mean a function that
isn't compiled if it isn't used anywhere?
Yes. That's exactly what I mean.
Use case?
.array
.sort
buildin arrays have a .sort-property that is called.
I have three questions?
If I change the iterator which I get from algorithm, the owner
data will change or not?
How to use std.algorithm.fill with char types?
What is the type of char array holds why it does not matches
char?
Regards
Kadir Erdem
I have no time to dig into this, but:
i
On Monday, 2 March 2015 at 15:14:49 UTC, Francesco Cattoglio
wrote:
On Monday, 2 March 2015 at 15:01:55 UTC, Tobias Pankrath wrote:
I'm really clueless... :P
Something is wrong with your Material class, but you'll need
to show us a reduced example.
After a really long time I finally found w
I'm really clueless... :P
Something is wrong with your Material class, but you'll need to
show us a reduced example.
On Monday, 2 March 2015 at 14:08:29 UTC, Francesco Cattoglio
wrote:
I'm trying to instantiate a std.container.Array of a given
class (named Material), by a simple
Array!Material _myStuff;
I get two compile errors stating the following:
C:\D\dmd2\windows\bin\..\..\src\phobos\std\container\array.
On Monday, 2 March 2015 at 12:37:33 UTC, drug wrote:
I guess the reason why std.conv.emplace is not @nogc-ed is that
nobody added it yet? I didn't see using of gc in the emplace
sources.
It's a template and an instance will be @nogc, if possible.
On Monday, 2 March 2015 at 10:15:00 UTC, ketmar wrote:
or, tl;dr: `const` in D is working as it was designed to work.
there are
no changes planning for it, and it will not be turned to
"c++-like" const.
It's working as it's designed to work, although the design is
somewhat lacking:
https://
On Thursday, 26 February 2015 at 15:57:22 UTC, Steven
Schveighoffer wrote:
On 2/25/15 4:58 AM, Ivan Timokhin wrote:
Tobias Pankrath wrote:
writefln("stack: %s", stack[]); //fine
This call consumes all ranges stored in stack, so they're
empty afterwards.
This has to be a bug. stack[]
On Wednesday, 25 February 2015 at 13:56:06 UTC, wobbles wrote:
Hi,
Any reason why the following wont work?
void main(string[] args)
{
auto pidIn = File.tmpfile();
auto pidOut = File.tmpfile();
auto pid = spawnProcess(["ls", "./"], pidIn, pidOut,
std.stdio.stdout, null, Config.newEnv
import std.container;
import std.stdio;
void main()
{
DList!int list;
Array!(DList!int.Range) stack;
foreach(i; 0 .. 4)
{
list.stableInsertBack(i);
stack.insertBack(list[]);
}
writefln("list: %s", list[]); // fine
writefln("stack: %s", stack[]); //fine
forea
On Tuesday, 24 February 2015 at 22:12:57 UTC, Freddy wrote:
Why are strings immutable but array literals are not?
Because string is an alias for immutable(char).
On Tuesday, 24 February 2015 at 12:05:51 UTC, amber wrote:
Hi,
Is it possible in D to have inheritance using value types, i.e.
structs?
No runtime polymorphism, but a kind of sub typing via alias this.
struct S { void foo() { writeln("S.foo"); }
struct T { S s; alias s this; }
T t;
t.foo();
On Sunday, 22 February 2015 at 13:53:51 UTC, Nordlöw wrote:
Is there some function similar to std.algorithm.find() which
returns an element index instead of a range? I guess 0 means no
hit and 1, 2, 3 means hits at indexes 0, 1, 2 etc.
I want this to avoid having to create ranges ([]) when
se
On Friday, 20 February 2015 at 08:25:49 UTC, rumbu wrote:
On Friday, 20 February 2015 at 07:57:17 UTC, Tobias Pankrath
wrote:
What's the reason behind this design?
class Super {}
class Sub : Super {}
void foo(Super[] sup) {}
void main() {
Sub[] array;
foo(array); // error, cannot call f
What's the reason behind this design?
class Super {}
class Sub : Super {}
void foo(Super[] sup) {}
void main() {
Sub[] array;
foo(array); // error, cannot call foo(Super[]) with arguments
(Sub[])
}
On Thursday, 19 February 2015 at 11:56:19 UTC, Nordlöw wrote:
Please provide reduced examples.
This fails:
class C
{
int[] a;
alias BH = BinaryHeap!(int[], (x, y) => (x+a < y));
}
This works:
class C
{
int[] a;
void foo() {
alias BH = BinaryHeap!(int[], (x, y) => (x+a
On Wednesday, 18 February 2015 at 14:38:24 UTC, Nordlöw wrote:
On Wednesday, 18 February 2015 at 14:07:01 UTC, Steven
Schveighoffer wrote:
An UNINITIALIZED AA has not yet been allocated, and so it's
reference is null.
What's reason for uninitialized AA not behaving in the same way
as arrays
On Wednesday, 18 February 2015 at 13:59:43 UTC, Nordlöw wrote:
On Wednesday, 18 February 2015 at 13:53:17 UTC, Tobias Pankrath
wrote:
All the data members except distMap have reference semantics.
I thought AAs had reference semantics.
Me too, but the indeed have value semantics. See for exam
On Wednesday, 18 February 2015 at 13:37:57 UTC, Nordlöw wrote:
I've written a Dijkstra-style graph traversal range at
https://github.com/nordlow/justd/blob/master/knet/traversal.d#L105
that needs to internally store the AA distance map in member
variable distMap.
1.
All the data members exc
Having this in the language will attract (more) Ada programmers
to D.
“Having this or that will attract (XY)-programmers / magically
make D successful in niche Z” is an argument too weak for phobos
inclusion, IMO.
On Monday, 16 February 2015 at 20:09:09 UTC, Nordlöw wrote:
I'm trying to figure out how to implement a light-weight wrappr
realizing type-safe indexing á lá Ada. Here's my first try:
struct Ix(T = size_t)
{
@safe pure: @nogc nothrow:
this(T ix) { this._ix = ix; }
alias _ix this;
On Monday, 16 February 2015 at 18:45:17 UTC, Suliman wrote:
Oh I understood. It's means that it work only of two or more
element's is placed one after one?
That's why you'll usually want to sort before using uniq.
On Monday, 16 February 2015 at 18:45:17 UTC, Suliman wrote:
Oh I understood. It's means that it work only of two or more
element's is placed one after one?
Yes, uniq returns exactly the same range as its input, except
that elemens that are equal to their immediate predecessor are
dropped.
Docs will get a lot better in the next release:
http://dlang.org/phobos-prerelease/std_algorithm_iteration.html#uniq
On Monday, 16 February 2015 at 18:28:13 UTC, Suliman wrote:
The question appear here
http://stackoverflow.com/questions/28546572/how-to-find-duplicates-in-array-of-strings-in-d
I can't understand, why uniq work for array of int but do not
work with array of strings.
int[] arr = [ 1, 2
On Monday, 16 February 2015 at 17:55:42 UTC, Jonathan Marler
wrote:
Why is the 'in' operator nogc but the index operator is not?
void main() @nogc
{
int[int] a;
auto v = 0 in a; // OK
auto w = a[0]; // Error: indexing an associative
// array in @nogc function m
On Monday, 16 February 2015 at 16:56:15 UTC, Per Nordlöw wrote:
Is there a specific function in to empty a builtin D array or
should I just do
auto x = [1,2,3];
x = [];
I'm asking because std.container.Array has the member .clear()
and I would like my code to compatible with both buil
On Friday, 13 February 2015 at 19:03:10 UTC, Jonathan Marler
wrote:
This question comes from wanting to be able to throw an
exception in code that is @nogc.
I don't know if it's possible but I'd like to be able to throw
an exception without allocating memory for the garbage
collector? You ca
On Friday, 13 February 2015 at 12:58:40 UTC, Per Nordlöw wrote:
On Friday, 13 February 2015 at 12:50:14 UTC, Tobias Pankrath
wrote:
There are no reference counts involved, just simple arithmetic.
string a = "abc";
string b = a[1 .. $];
Then how does the GC know when to release when there are
On Friday, 13 February 2015 at 12:40:57 UTC, Per Nordlöw wrote:
On Friday, 13 February 2015 at 11:52:50 UTC, Tobias Pankrath
wrote:
On Friday, 13 February 2015 at 11:34:50 UTC, Per Nordlöw wrote:
On Friday, 13 February 2015 at 09:13:48 UTC, Kagamin wrote:
Whether s.front uses GC is determined b
On Friday, 13 February 2015 at 11:34:50 UTC, Per Nordlöw wrote:
On Friday, 13 February 2015 at 09:13:48 UTC, Kagamin wrote:
Whether s.front uses GC is determined by s.front
implementation, caller can't affect it.
Compiling
https://github.com/nordlow/justd/blob/master/t_splitter.d
with -vgc o
On Friday, 13 February 2015 at 08:21:53 UTC, Per Nordlöw wrote:
When reading/parsing data from disk often try to write code
such as
foreach (const line; File(filePath).byLine)
{
auto s = line.splitter(" ")
const x = s.front.to!uint; s.popFront;
const y = s.front
On Tuesday, 10 February 2015 at 08:40:38 UTC, Dennis Ritchie
wrote:
On Tuesday, 10 February 2015 at 08:12:00 UTC, Vladimir
Panteleev wrote:
Why is that?
Потому что я спорил с одним упёртым человеком, которому не
нравится D, на этом форуме:
http://www.cyberforum.ru/holywars/thread1367892-page
On Monday, 9 February 2015 at 19:40:42 UTC, Dennis Ritchie wrote:
Good evening.
Is it possible to D something to replace the container on the
F#, which displays the values of the sine from 0 to 90 degrees
with an interval of 10 degrees:
let pi = Math.PI
let sins = [for x in 0.0..pi / 2.0 / 9.0
On Sunday, 8 February 2015 at 23:13:33 UTC, Venkat Akkineni wrote:
Never mind, stupid question I realize, would delete it if I
could.
http://stackoverflow.com/questions/11047276/null-for-primitive-data-types
Check for null with (x is null) not via printing to stdout.
On Thursday, 5 February 2015 at 13:55:59 UTC, FrankLike wrote:
On Thursday, 5 February 2015 at 13:29:30 UTC, Tobias Pankrath
wrote:
Works as designed:
http://dlang.org/phobos/std_algorithm.html#.remove
Thank you.
aa = remove(aa,1);//ok
but how to remove one item?
such as aa.remove(2) ?
I
On Thursday, 5 February 2015 at 13:25:37 UTC, FrankLike wrote:
Now I can remove element from a array:
module removeOne;
import std.stdio;
import std.array;
import std.algorithm;
void main()
{
int[] aa =[1,2,3,4,5];
aa = aa[0..2] ~aa[3..$];
writeln(aa); //ok
import std.algorithm;
int main(string[] options)
{
// true if the first option given to this program is
either foo, bar, or baz.
if(options[1].canFind("foo", "bar", "baz"))
return 0;
return 1;
}
On Tuesday, 3 February 2015 at 23:07:03 UTC, Foo wrote:
On Tuesday, 3 February 2015 at 19:44:49 UTC, FG wrote:
On 2015-02-03 at 19:53, Foo wrote:
How can I do that without any GC allocation? Nothing in
std.file seems to be marked with @nogc
I'm asking since it seems very complicated to do tha
On Tuesday, 3 February 2015 at 19:44:49 UTC, FG wrote:
On 2015-02-03 at 19:53, Foo wrote:
How can I do that without any GC allocation? Nothing in
std.file seems to be marked with @nogc
I'm asking since it seems very complicated to do that with
C++, maybe D is a better choice, then we would pr
1. I prefer
alias CellList = Cell[];
over
alias Cell[] CellList;
2. Do you really need to create a complete new CellList for every
single removal? If so, you'd know the size of the new list in
advance and can allocate it directly at the correct size.
I get the impression that you think Cell[
On Friday, 30 January 2015 at 17:07:17 UTC, Paul wrote:
On Friday, 30 January 2015 at 16:21:24 UTC, Kagamin wrote:
writeln("Sorted, reversed: ", retro(sort(myVals)));
?
Or...
writeln("Reverse sorted: ", sort!("a > b")(vals));
but I still don't understand the original 'error'.
Take a look a
This is almost the same code as written initially,
let somone explain why the hell this is working:
---
module test;
import std.conv;
class Parent {
@property final string typeName() {
return to!string(this);
}
}
class Child : Parent {
}
void main() {
auto p = new Parent;
auto c =
On Wednesday, 28 January 2015 at 12:29:09 UTC, Fyodor Ustinov
wrote:
On Wednesday, 28 January 2015 at 11:27:53 UTC, Kagamin wrote:
Associative array doesn't support thread-safe operations,
that's why they don't work on shared instance. You should use
std.concurrency or implement low-level concu
-
class Bar
{
static T construct(this T, A...)(A a)
{
return new T(a);
}
}
I think it's a bug that you can use a template this parameter
(this T) on a static member function without a direct compilation
error.
-
class Bar
{
static typeof(this) construct(A
On Sunday, 25 January 2015 at 18:15:21 UTC, Paul wrote:
I'd like to vary the query based on input but if I try to move
the string out of the sqlite3_exec call like this:
string sqlStatement = "CREATE TABLE people(id INT PRIMARY KEY
NOT NULL, surname TEXT NOT NULL);";
result = sqlite3_exec(db,
On Sunday, 25 January 2015 at 12:25:35 UTC, Dominikus Dittes
Scherkl wrote:
map!(x => fn(cast(ParameterTypeTuple!fn[0])x)
but instead with
map!(paramCast!fn)
Because this is useful in more situations, e.g. in every place
where you know the values would fit into the parameter (and for
a sing
On Sunday, 25 January 2015 at 10:21:34 UTC, Suliman wrote:
But is it good practice to fail with exception during passing
unknown parameters? Maybe std.getopt.config.passThrough should
be as default?
I really can't remember Apps that crush if pass to in unknown
parameters.
Almost all program
On Saturday, 24 January 2015 at 20:49:03 UTC, Dominikus Dittes
Scherkl wrote:
Maybe I'm just too stupid, but I cannot manage to call a simple
function
with all 256 possible values of ubyte with iote:
int foo(ubyte c);
auto myRange = iota(0,256).map!foo;
--> Error: function foo(ubyte c) is no
1 - 100 of 163 matches
Mail list logo