On Monday, 29 January 2018 at 13:55:04 UTC, Seb wrote:
On Monday, 29 January 2018 at 11:36:26 UTC, aliak wrote:
On Monday, 29 January 2018 at 06:46:26 UTC, Ali Çehreli wrote:
I think the following trivial wrapper around
std.algorithm.remove() should do:
void removeMatching(R, N)(ref R r, N ne
On Monday, 29 January 2018 at 12:10:16 UTC, Simen Kjærås wrote:
Consider this case:
immutable(int)[] a = [1,2,3];
immutable(int)* b = &a[1];
You're free to slice the array or pop elements off its front or
back, but if you change the order of elements, the value that b
points to will change.
Hello everyone.I'm a newbie on the D language.When i use the
library 'std.conv' ,i met some problem.
This is what I have:
static import std.conv;
string aaa = "123456789";
uint idx = 5;
string bbb = aaa[0 .. idx];
uint work = std.conv.parse!(uint)(bbb); // this works
ui
On Tuesday, January 30, 2018 09:19:22 Jacky via Digitalmars-d-learn wrote:
> Hello everyone.I'm a newbie on the D language.When i use the
> library 'std.conv' ,i met some problem.
> This is what I have:
>
> static import std.conv;
> string aaa = "123456789";
> uint idx = 5;
> st
On 01/30/2018 12:17 AM, aliak wrote:
> So if a struct has a struct that has any member const, then effectively
> that whole struct is a const (well immutable it seems, so not even
> const)?
No, it cannot be assigned but the other parts of the object can be mutated.
> Is that really correct? Wha
On Tuesday, 30 January 2018 at 09:29:22 UTC, Jonathan M Davis
wrote:
On Tuesday, January 30, 2018 09:19:22 Jacky via
Digitalmars-d-learn wrote:
[...]
The first one passes an lvalue. The second one passes an
rvalue. parse takes its argument by ref so that what is parsed
is removed from the in
Is there a way to get a compile error when returning a temporary
from a function and then not assigning it to a variable or
passing it to a different function? E.g:
struct S {
int[] a;
void morph() {}
}
@warnOnDiscard
S foo() {
return S([1,2,3]);
}
unittest {
auto a = foo(); /
On Tuesday, January 30, 2018 10:49:54 Simen Kjærås via Digitalmars-d-learn
wrote:
> Is there a way to get a compile error when returning a temporary
> from a function and then not assigning it to a variable or
> passing it to a different function? E.g:
>
> struct S {
> int[] a;
> void mo
On Tuesday, 30 January 2018 at 11:36:25 UTC, Jonathan M Davis
wrote:
[nope]
Thanks. It's what I thought, though not what I wanted.
IIRC, the Weka guys wanted to be able to have attributes tell
the compiler stuff so that it could yell at the programmer when
appropriate, so I think that there
On Tue, 30 Jan 2018 05:56:51 +, DanielG wrote:
> Then there's all the modern Microsoft stuff (WPF/XAML/WinRT/etc),
> but you pretty much have to use either .NET or C++ for that.
VS release builds compile to native now by default; for easy Windows
programming, you really can't beat C# and dra
On Monday, 29 January 2018 at 22:55:12 UTC, I Lindström wrote:
The other way I've been thinking is to do the thing
browser-based, but for some reason that doesn't feel right.
Ironically the trick for native programming is to depend on the
OS as less as possible, with a small "API surface".
On 1/29/18 8:20 PM, Jonathan M Davis wrote:
On Tuesday, January 30, 2018 01:05:54 Drone1h via Digitalmars-d-learn wrote:
Hello all,
I am trying to implement a ("struct template" ? what is the
correct word ?) range that just forwards its primitives ("empty",
"front", "popFront") to another ran
On Tuesday, 30 January 2018 at 10:49:54 UTC, Simen Kjærås wrote:
Is there a way to get a compile error when returning a
temporary from a function and then not assigning it to a
variable or passing it to a different function? E.g:
struct S {
int[] a;
void morph() {}
}
@warnOnDiscard
S
On Sunday, 28 January 2018 at 22:02:11 UTC, Timoses wrote:
How would I do that?
https://forum.dlang.org/post/mailman.39.1510078013.9493.digitalmars-d-...@puremagic.com
like this
On Sunday, 28 January 2018 at 21:41:39 UTC, Timoses wrote:
Got it from here:
http://d-apt.sourceforge.net/
with
$ apt-get install dmd-compiler
Sometimes such crashes can be caused by files left from previous
installation. Or maybe confusion between gdc and dmd files.
On Tuesday, 30 January 2018 at 05:47:11 UTC, thedeemon wrote:
It's like saying "everything you need is assembly language"
when talking about languages and compilers. Pure WinAPI is a
cruel advice for a novice.
He's not a novice: he wrote console applications that pushed
through complexity lim
On Monday, 29 January 2018 at 22:55:12 UTC, I Lindström wrote:
I've been Googling a ton these past few days for some kind of a
book or a course on how to code desktop applications for
Windows, but either there isn't one, or it's very well hidden.
"Programming Windows" by Charles Petzold, 5th e
Hello,
Several times I faced with next problem: I have "@safe" routine
with few calls to @system functions inside: OS calls (recv, send,
kqueue) os some phobos unsafe functions like assumeUnique. I'd
like not to wrap these @system functions in @trusted wrappers,
but somehow mark these calls @
On Tuesday, 30 January 2018 at 15:05:38 UTC, ikod wrote:
Hello,
Several times I faced with next problem: I have "@safe" routine
with few calls to @system functions inside: OS calls (recv,
send, kqueue) os some phobos unsafe functions like
assumeUnique. I'd like not to wrap these @system funct
On Monday, 29 January 2018 at 22:55:12 UTC, I Lindström wrote:
Hello all!
I've been doing console apps for about a year and a half now,
but my requirements are reaching the limits of easy to use with
ASCII-based UI and typed commands so I'm thinking of moving
into GUI-era with my projects. I
On Tue, Jan 30, 2018 at 08:54:00AM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 1/29/18 8:20 PM, Jonathan M Davis wrote:
[...]
> > If you want to put an attribute on it, inout is better, because then
> > it will work with any constness, but in general, I'd suggest just
> > avoid
On Tuesday, 30 January 2018 at 14:01:00 UTC, bauss wrote:
unittest {
auto a = foo(); // This should fail, because a is
never used.
No it shouldn't. It is assigned to a variable, as the constraint
said.
// This should also fail, because b is never used actually
used afterw
On Tuesday, 30 January 2018 at 14:08:35 UTC, Kagamin wrote:
On Sunday, 28 January 2018 at 22:02:11 UTC, Timoses wrote:
How would I do that?
https://forum.dlang.org/post/mailman.39.1510078013.9493.digitalmars-d-...@puremagic.com
like this
Thanks!
I did
$ gdb main
$ (gdb) set logging on
$ (
The common C way to get a blob of generic data at runtime is to
use void pointers like so:
struct Structo {
int type;
void* data;
}
Then cast the void pointer to whatever data you needed based on
the type. I imagine D has a better mechanism for this sort of
thing, but after some searching
On Tuesday, 30 January 2018 at 17:41:53 UTC, jsako wrote:
So what's considered the best alternative to void pointers in D
if you don't want to use objects? Make a tagged Union of all
possible datatypes in the struct? Have a Byte array and cast
that instead of a void pointer? Some sort of magic
import std.container;
import std.format;
Array!char str;
str.length = 256;
str.sformat!"%s:%s"("some", "string");
// Error: template std.format.sformat cannot deduce function
from argument types !("%s:%s")(Array!char, string, string),
candidates are:
//
On Tuesday, 30 January 2018 at 05:56:51 UTC, DanielG wrote:
There are far too many options for Windows GUI programming, so
we probably need a bit more information about any constraints
that are important to you.
For example:
- do you specifically want something that works well with D? or
are
On 1/30/18 12:53 PM, cc wrote:
import std.container;
import std.format;
Array!char str;
str.length = 256;
str.sformat!"%s:%s"("some", "string");
// Error: template std.format.sformat cannot deduce function from
argument types !("%s:%s")(Array!char, string, string),
On Tuesday, 30 January 2018 at 12:30:36 UTC, rjframe wrote:
VS release builds compile to native now by default; for easy
Windows programming, you really can't beat C# and drawing the
GUI (Windows Forms, not necessarily the new stuff). If the OP
wants to learn what's needed for more complex GU
Still doesn't work without the cast it seems..
auto rng = str[];
rng.sformat!"%s:%s"("some", "string");
// Error: template std.format.sformat cannot deduce function
from argument types !("%s:%s")(RangeT!(Array!char), string,
string)
On Tuesday, 30 January 2018 at 18:42:45 UTC, Steven Schveighoffer
wrote:
On 1/30/18 12:53 PM, cc wrote:
import std.container;
import std.format;
Array!char str;
str.length = 256;
str.sformat!"%s:%s"("some", "string");
// Error: template std.format.sformat cannot de
On Tuesday, 30 January 2018 at 09:51:18 UTC, Ali Çehreli wrote:
> [...]
is trying to
> [...]
It's the same with C++: A type with a const member cannot have
a compiler-generated assignment operator.
Ok, that made it obvious :)
'const' as a member function attribute is meaningful: It makes
t
On Sunday, 28 January 2018 at 19:17:49 UTC, Steven Schveighoffer
wrote:
This is insane. i > 0 is used in so many places. The only
saving grace appears to be that int.min is just so uncommonly
seen in the wild.
And another one that it does not happen when compiled with
optimization (-O) and al
On Tuesday, 30 January 2018 at 18:41:57 UTC, I Lindström wrote:
On Tuesday, 30 January 2018 at 05:56:51 UTC, DanielG wrote:
There are far too many options for Windows GUI programming, so
we probably need a bit more information about any constraints
that are important to you.
For example:
- d
On Tuesday, January 30, 2018 07:49:28 H. S. Teoh via Digitalmars-d-learn
wrote:
> On Tue, Jan 30, 2018 at 08:54:00AM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> > On 1/29/18 8:20 PM, Jonathan M Davis wrote:
> [...]
>
> > > If you want to put an attribute on it, inout is better, b
On Tue, Jan 30, 2018 at 06:05:47PM -0700, Jonathan M Davis via
Digitalmars-d-learn wrote:
> On Tuesday, January 30, 2018 07:49:28 H. S. Teoh via Digitalmars-d-learn
> wrote:
[...]
> > Simen has had some ideas recently about "head mutable" aka
> > tail-const, which could be a first step towards ma
Is there any way to initialize an array of unions with more than
just the first union type?
struct A { float a; }
struct B { uint b; }
union Test
{
A a;
B b;
}
Test[2] test =
[
Test(A(1.0f)),
Test(B(10)), // ERROR
];
AFAIK there's no way to specify to use D with an initial
On Thursday, 11 January 2018 at 12:36:22 UTC, Guillaume Piolat
wrote:
On Thursday, 11 January 2018 at 12:27:27 UTC, DanielG wrote:
[snip]
You may have some unittest blocks in your source files, and
then type:
$ dub test
[snip]
When I try 'dub test' I get errors like 'Source file
On 01/30/2018 07:33 PM, Rubn wrote:
Is there any way to initialize an array of unions with more than just
the first union type?
struct A { float a; }
struct B { uint b; }
union Test
{
A a;
B b;
}
Test[2] test =
[
Test(A(1.0f)),
Test(B(10)), // ERROR
];
AFAIK there's n
On Wednesday, 31 January 2018 at 01:45:57 UTC, H. S. Teoh wrote:
.headConst
.headMutable. :p Head-const is something we generally want to
avoid.
--
Simen
40 matches
Mail list logo