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
Cross module inline procs are inlined across modules without link time
optimization, the Nim compiler duplicates the inline procs in the generated C
code.
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
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
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