On Wednesday, 15 August 2018 at 06:39:50 UTC, Mike Parker wrote:
String literals are implicitly convertible to const(char)* and
are guaranteed to be nul-terminated like a C string, so this
works:
[...]
Does that help?
Yes, indeed. I think I possibly read about literal strings being
On Wednesday, 15 August 2018 at 21:42:11 UTC, Jonathan M Davis
wrote:
What are you actually trying to do? Aside from the circular
reference issues, using the address of a struct like that is
very risky, because if the struct is ever moved, it will change.
Yeah... my functions are all ref.
On Wednesday, August 15, 2018 10:40:49 AM MDT Alex via Digitalmars-d-learn
wrote:
> Hi all.
> Finally, I arrived at something like this:
>
> ´´´
> void main()
> {
> S!(sarr)[] sarr;
> }
>
> struct S(alias Reference)
> {
> size_t id()
> in
> {
> // not static assert, only because a
On 8/15/18 2:12 PM, Steven Schveighoffer wrote:
https://issues.dlang.org/show_bug.cgi?id=19171
PR: https://github.com/dlang/phobos/pull/
-Steve
On 8/15/18 2:05 PM, Steven Schveighoffer wrote:
On 8/15/18 12:27 PM, 0xEAB wrote:
On Wednesday, 15 August 2018 at 15:13:50 UTC, Kagamin wrote:
It's a bug:
Is it a known one?
Nope. And I figured out the problem. Will submit a fix.
https://issues.dlang.org/show_bug.cgi?id=19171
-Steve
On 8/15/18 12:27 PM, 0xEAB wrote:
On Wednesday, 15 August 2018 at 15:13:50 UTC, Kagamin wrote:
It's a bug:
Is it a known one?
Nope. And I figured out the problem. Will submit a fix.
-Steve
On Wednesday, 15 August 2018 at 16:40:49 UTC, Alex wrote:
Hi all.
Finally, I arrived at something like this:
´´´
void main()
{
S!(sarr)[] sarr;
}
struct S(alias Reference)
{
size_t id()
in
{
// not static assert, only because a pointer is never known
in
Hi all.
Finally, I arrived at something like this:
´´´
void main()
{
S!(sarr)[] sarr;
}
struct S(alias Reference)
{
size_t id()
in
{
// not static assert, only because a pointer is never known in
advance
assert(Reference.ptr <= );
}
On Wednesday, 15 August 2018 at 15:13:50 UTC, Kagamin wrote:
It's a bug:
Is it a known one?
It's a bug:
auto s=ar[];
s.popFront();
auto s1=s[0..0]; //out of bounds
On Wednesday, 15 August 2018 at 13:53:02 UTC, Andrey wrote:
Hello,
I have the following code:
string[] list;
string text;
// ...
enum pattern = ctRegex!`^[0-9]+$`;
list = text.split('\n').map!(line =>
line.matchFirst(pattern).hit);
Compiler says that it can't convert result of map function
Hello,
I have the following code:
string[] list;
string text;
// ...
enum pattern = ctRegex!`^[0-9]+$`;
list = text.split('\n').map!(line =>
line.matchFirst(pattern).hit);
Compiler says that it can't convert result of map function to
string[]...
What I want:
1. Split some text into lines
core.exception.AssertError@/src/phobos/std/container/array.d(1667): Using out
of bounds indexes on an Array
Should this code[1] really try to access something out of bounds
and assert?
Also: shouldn't this assertion[2] be perhaps inside
`version(D_NoBoundsChecks){} else { ... }` block?
On Wednesday, 15 August 2018 at 10:38:23 UTC, Jonathan M Davis
wrote:
Would it be sane to add these to std.conv alongside existing
std.conv.to so that underlying logic in std.conv.to can be
reused?
If so, AFAICT, existing std.conv.to should be implemented on
Put something together to get
On Wednesday, 15 August 2018 at 09:26:26 UTC, Seb wrote:
If so, AFAICT, existing std.conv.to should be implemented on
top of std.conv.tryTo.
Well, for now you can use `ifThrown` from std.exception:
https://dlang.org/phobos/std_exception.html#ifThrown
---
"foo".to!int.ifThrown(42)
But the
On Tuesday, 14 August 2018 at 16:03:05 UTC, vit wrote:
import std.traits : EnumMembers;
import std.string : join;
import std.algorithm : map;
pragma(msg, [EnumMembers!Type].map!(x => cast(string)x).join("
"));
Thank you!
Jonathan M Davis, I understood.
On Wednesday, 15 August 2018 at 08:14:53 UTC, Petar Kirov
[ZombineDev] wrote:
It's not a bug, it's all about how the type system is set up.
The type of an array literal expression like `[1, 2, 3]` is
`int[]` (a slice of an array of ints), so no matter if you do:
auto readonly(T)(const(T)[]
On Wednesday, August 15, 2018 3:21:29 AM MDT Per Nordlöw via Digitalmars-d-
learn wrote:
> Have anybody thought about non-throwing variants of std.conv.to
> typically named `tryTo`
> similar to what Folly
>
> https://github.com/facebook/folly/blob/master/folly/docs/Conv.md#non-throw
>
On Wednesday, 15 August 2018 at 09:21:29 UTC, Per Nordlöw wrote:
Have anybody thought about non-throwing variants of std.conv.to
typically named `tryTo`
similar to what Folly
https://github.com/facebook/folly/blob/master/folly/docs/Conv.md#non-throwing-interfaces
does, for instance, as
Have anybody thought about non-throwing variants of std.conv.to
typically named `tryTo`
similar to what Folly
https://github.com/facebook/folly/blob/master/folly/docs/Conv.md#non-throwing-interfaces
does, for instance, as
tryTo(str).then([](int i) { use(i); });
?
Would it be sane to add
On Wednesday, 15 August 2018 at 08:14:53 UTC, Petar Kirov
[ZombineDev] wrote:
https://run.dlang.io/is/iD9ydu
I made a typo in one of the comments. Here's the fixed version:
https://run.dlang.io/is/HRqYcZ
On Tuesday, 14 August 2018 at 17:49:32 UTC, Mike Franklin wrote:
On Tuesday, 14 August 2018 at 17:22:42 UTC, Seb wrote:
FYI: staticArray will be part of 2.082, it already works with
dmd-nightly:
That just seems wrong. Isn't the fact that `staticArray` is
needed a bug in the compiler? I
On Wednesday, 15 August 2018 at 02:40:22 UTC, Joe wrote:
I understand that, Mike. However if I'm not mistaken given
something in C like
char* strs[] = { "This", "is a", "test"};
AFAIK, even with -betterC and an extern (C), the literals will
still be understood by D as type "string", and
23 matches
Mail list logo