Hi all!
I have, maybe, a silly question..
Not sure, if
https://forum.dlang.org/post/ibxhuqamgclrcatsy...@forum.dlang.org
has something to do with the topic
Having the following code:
import std.typecons;
import std.algorithm;
void main()
{
uint[] arr_ref;
arr_ref.length = 5;
assert(
On Saturday, 12 March 2016 at 14:33:19 UTC, Alex wrote:
//arr[] = 1;
The question is, why the commented out line throws the error:
Error: cannot implicitly convert expression (1) of type int to
Nullable!uint[],
while the line after that works.
Looks like a bug somewhere. The work around
On Saturday, 12 March 2016 at 15:44:00 UTC, Mike Parker wrote:
On Saturday, 12 March 2016 at 14:33:19 UTC, Alex wrote:
//arr[] = 1;
The question is, why the commented out line throws the error:
Error: cannot implicitly convert expression (1) of type int to
Nullable!uint[],
while the line
On Saturday, 12 March 2016 at 14:33:19 UTC, Alex wrote:
/snip
I thought this was supposed to halt with an error rather than
compile and set all members to 1.
The syntax, to me anyways, doesn't really communicate the
intention of: set all members to 1.
//arr[] = 1;
Whereas the following
specific array behaves
not as expected.
So, either there is a problem with filling an array, or, there is
a problem with implicit conversion of a Nullable!T to its
underlying type.
On 12.03.2016 16:44, Mike Parker wrote:
arr[] = cast(Nullable!uint)1;
Nicer than a cast: construct a Nullable!int.
arr[] = Nullable!uint(1);
On Saturday, 12 March 2016 at 19:35:30 UTC, ag0aep6g wrote:
On 12.03.2016 16:44, Mike Parker wrote:
arr[] = cast(Nullable!uint)1;
Nicer than a cast: construct a Nullable!int.
arr[] = Nullable!uint(1);
ok... so... this makes the error very strange, then... almost
senseless...
array
in such a manner. And my question was, why a specific array
behaves not as expected.
So, either there is a problem with filling an array, or, there
is a problem with implicit conversion of a Nullable!T to its
underlying type.
Learned something new. I guess I missed that detail when I read
that page.
Hi,
I would like to pre-create a double array, each element is calculated by
a function.
//-
import std.stdio;
import std.conv;
import std.string;
template f(int N)
{
bool fn(double[] tb)
{
for (int i = 1; i <
The Anh Tran wrote:
static double[N] dd = void;
dd is not a compile-time constant.
static auto tmp = f!(N).fn(dd);
The initializer of tmp must be a compile-time constant, but since dd is
not a compile-time constant, you can't use CTFE on fn.
Will the loop (foreach) run at compile time? How can I make it
work at compile time?
```
import std.csv, std.stdio;
alias Record = Tuple!(string, string, string);
immutable string[][] table;
shared static this() {
string csvText = import("file.csv");
foreach (record; csvReader!Record(
On Wednesday, 9 February 2022 at 08:12:52 UTC, Vindex wrote:
Will the loop (foreach) run at compile time? How can I make it
work at compile time?
```
import std.csv, std.stdio;
alias Record = Tuple!(string, string, string);
immutable string[][] table;
shared static this() {
string csvTex
On Wednesday, 9 February 2022 at 08:12:52 UTC, Vindex wrote:
Will the loop (foreach) run at compile time? How can I make it
work at compile time?
```
import std.csv, std.stdio;
alias Record = Tuple!(string, string, string);
immutable string[][] table;
shared static this() {
string csvTex
On Wednesday, 9 February 2022 at 10:01:15 UTC, Anonymouse wrote:
On Wednesday, 9 February 2022 at 08:12:52 UTC, Vindex wrote:
Will the loop (foreach) run at compile time? How can I make it
work at compile time?
```
import std.csv, std.stdio;
alias Record = Tuple!(string, string, string);
imm
On Wednesday, 9 February 2022 at 10:01:15 UTC, Anonymouse wrote:
On Wednesday, 9 February 2022 at 08:12:52 UTC, Vindex wrote:
[...]
I would do this.
```
import std;
alias Record = Tuple!(string, string, string);
static immutable string[][] table = () {
string[][] table;
string csvTe
On Wednesday, 9 February 2022 at 10:25:34 UTC, bauss wrote:
Is it guaranteed that the value is initialized at compiletime
however?
yes, D guarentees this at 100%.
On 2/9/22 01:07, bauss wrote:
> It will not run at compile-time because csvText is a runtime variable.
> It should be enum to be accessible at compile-time.
Yes. For the sake of completeness, any expression needed at compile time
will be (attempted to be) executed at compile time. For example,
On 2/9/22 08:37, Ali Çehreli wrote:
> In any case, some people may find a compile-time file parsing example
> that I included in a presentation:
That should mean "may find interesting". And I've just realized that the
chapter link is off in that video. This is the beginning of that section:
On Wednesday, 9 February 2022 at 16:37:22 UTC, Ali Çehreli wrote:
On 2/9/22 01:07, bauss wrote:
> It will not run at compile-time because csvText is a runtime
variable.
> It should be enum to be accessible at compile-time.
Yes. For the sake of completeness, any expression needed at
compile tim
19 matches
Mail list logo