On Sunday, 21 January 2024 at 18:38:42 UTC, atzensepp wrote:
What if you add more lines to the file. Does it crash then
later?
It's a problem with `vectors`. `vector!string` has a problem , I
just use 'string []', and it's OK.
The `vector` is unstable, possibly because the `later data`
On Sunday, 21 January 2024 at 03:54:35 UTC, zjh wrote:
On Thursday, 18 January 2024 at 03:07:13 UTC, zjh wrote:
```d
void toV(string a,ref vector!string b){
auto f=File(a,"r");
while(!f.eof()){
string l=strip(f.readln());push(b,l);
}
Qwk(b);
}//
```
There is an issue
On Thursday, 18 January 2024 at 03:07:13 UTC, zjh wrote:
```d
void toV(string a,ref vector!string b){
auto f=File(a,"r");
while(!f.eof()){
string l=strip(f.readln());push(b,l);
}
Qwk(b);
}//
```
There is an issue with the `vector` here, I don't know why the
subsequent
On Friday, 19 January 2024 at 02:13:08 UTC, zjh wrote:
...
`Compile command`:
```d
dmd -i cy2.d dparse.lib
```
need libdparse lib.
On Thursday, 18 January 2024 at 03:07:13 UTC, zjh wrote:
```d
import std.stdio, std.range,std.file;
import std.string:strip;
import dparse.ast;
import dparse.lexer;
import dparse.parser : parseModule;
import dparse.rollback_allocator : RollbackAllocator;
import core.stdcpp.vector;
import
On Thursday, 18 January 2024 at 04:31:52 UTC, zjh wrote:
On Thursday, 18 January 2024 at 04:24:18 UTC, zjh wrote:
```d
class V : ASTVisitor
{
Vector!string f=[];
alias visit = ASTVisitor.visit;
override void visit(const FunctionDeclaration decl)
{
writeln('
On Thursday, 18 January 2024 at 04:24:18 UTC, zjh wrote:
```d
class V : ASTVisitor
{
Vector!string f=[];
alias visit = ASTVisitor.visit;
override void visit(const FunctionDeclaration decl)
{
writeln(' '.repeat(indentLevel * 4), decl.name.text);
On Thursday, 18 January 2024 at 04:20:12 UTC, zjh wrote:
foreach(e;d){
```d
foreach(e;d){//.0
string b=e;
string m=readText(b);ff(m,b);
}
```
or here `.0`? why crash?
On Thursday, 18 January 2024 at 03:53:09 UTC, Steven
Schveighoffer wrote:
Are you sure this is what you are wanting to do?
-Steve
```d
void gg(string a){
Vector!string d=[];toV(a,d);//File to Vector
print(d);//3,OK
foreach(e;d){
string b=e;//.1
string
On Thursday, 18 January 2024 at 03:07:13 UTC, zjh wrote:
```d
import dparse.ast;
import dparse.lexer;
import dparse.parser : parseModule;
import dparse.rollback_allocator : RollbackAllocator;
import core.stdcpp.vector;
import core.stdcpp.string;
...
```
I have no experience with using cpp from
On Thursday, 18 January 2024 at 03:11:57 UTC, zjh wrote:
```d
string b=d[i];//the 3th:vector.d
//`+Object`,crashes!
```
```d
//d[i]==>e
string b=e;
```
in the foreach.
On Thursday, 18 January 2024 at 03:07:13 UTC, zjh wrote:
Why can `b` still affect `e` here? Isn't `b` copied?
here foreach crashes.
Starting from the `third one`, it crashes. It's clearly
`vector.d`, but the result is`+Object`.
```d
string b=d[i];//the 3th:vector.d
//`+Object`,crashes!
```
```d
import dparse.ast;
import dparse.lexer;
import dparse.parser : parseModule;
import dparse.rollback_allocator : RollbackAllocator;
import core.stdcpp.vector;
import core.stdcpp.string;
Vector!string d=[];toV(a,d);
print(d);//3
foreach(e;d){
string b=d[i];
string
13 matches
Mail list logo