Re: Seq with custom fields

2017-01-07 Thread Krux02
not much tested this on my own, but I think this should make all iterators available converter toseq[T](arg: ExtSeq[T]): seq[T] = arg.s converter toseq[T](arg: var ExtSeq[T]): var seq[T] = arg.s

Re: Seq with custom fields

2017-01-05 Thread Araq
Cross module inline procs are inlined across modules without link time optimization, the Nim compiler duplicates the inline procs in the generated C code.

Re: Seq with custom fields

2017-01-04 Thread Stefan_Salewski
Thanks for that example! I think I have seen code somewhere where someone has used templates for something similar, but i can not find it currently. But I also think that inline procs should be fine. Well, for inline procs to work over module boundaries we may need link time optimization

Re: Seq with custom fields

2017-01-04 Thread def_pri_pub
You will need to add this proc for the add: proc add*(es: var ExtSeq; x: int) {.inline.}= es.s.add(x) The inline pragma isn't necessary, but it speeds things up a little. For using the index tokens ([ and ]), you just need to override that proc too: # Get

Seq with custom fields

2017-01-04 Thread Stefan_Salewski
I think I have still not really learned that. I think I may write something like type ExtSeq = object s: seq[int] timestamp: string var es: ExtSeq # init es.s.add(7) echo es.s[0] echo es.timestamp But I would