Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make std/lists usable with ptr instead of ref #593

Draft
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

timotheecour
Copy link
Owner

@timotheecour timotheecour commented Feb 17, 2021

just to illustrate that it's possible with a small diff, see tests

note

it'd be better if something like this worked, which depends on nim-lang/RFCs#85 (default generic params):

type
  SinglyLinkedList*[T; isPtr: static bool = false] = object
    when isPtr:
      head*: SinglyLinkedNode[T, true]
      tail*: SinglyLinkedNode[T, true]
    else:
      head*: <//>(SinglyLinkedNode[T])
      tail* {.cursor.}: SinglyLinkedNode[T]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant