Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@NotsoanoNimus
Copy link
Contributor

Noticed recently that LinkedList is a bit crusty. Updated it with some operator overloads and some other quality-of-life methods.

It's probably not well-advised to use foreach_r on this structure as it would be quite expensive. I don't know of a way to explicitly override that behavior to start from the tail of the list.

Also updated the corresponding unit tests to use the more "standard" test:: functions, as well as added LinkedList capability tests to some core array:: functions.

@lerno lerno merged commit 078d9dc into c3lang:master Sep 6, 2025
47 checks passed
@lerno
Copy link
Collaborator

lerno commented Sep 6, 2025

I changed it a bit to drop the random access, because that's hinting at a contract that's simply bad. So instead it's just returning an array_view which is that iterator, since it then can be used for general access. That makes it more obvious what's happening. The only thing I'm not happy about is that array_view is a bit long as a name

NotsoanoNimus added a commit to NotsoanoNimus/c3c that referenced this pull request Oct 9, 2025
* Add LinkedList Operators and Update Tests
* add linkedlist printing and `@new` macros (single-line init and pool-capable)
* add linkedlist node and reg iterator; comparisons w/ ==
* Fix benchmarks. Drop random access to the linked list using []. Only return a direct array view.

---------

Co-authored-by: Christoffer Lerno <[email protected]>
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.

2 participants