Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefane Fermigier
neo
Commits
348ac802
Commit
348ac802
authored
Jan 15, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
75afd6a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
go/xcommon/xcontainer/list/list.go
go/xcommon/xcontainer/list/list.go
+11
-4
No files found.
go/xcommon/xcontainer/list/list.go
View file @
348ac802
...
@@ -18,15 +18,22 @@
...
@@ -18,15 +18,22 @@
// See https://www.nexedi.com/licensing for rationale and options.
// See https://www.nexedi.com/licensing for rationale and options.
// Package list provides intrusive double-linked lists.
// Package list provides intrusive double-linked lists.
//
// Go standard library has container/list package which already provides
// double-linked lists. However in that implementation list itself is kept
// separate from data structures representing elements. This package provides
// alternative approach where elements embed necessary list heads which is
// sometimes more convenient, for example when one wants to move a list
// element in O(1) starting from pointer to just its data.
//
// TODO doc how to get to container of list head via unsafe.OffsetOf.
package
list
package
list
// Head is a list head entry for an element in an intrusive doubly-linked list.
// Head is a list head entry for an element in an intrusive doubly-linked list.
//
//
// XXX doc how to get to container of this list head via unsafe.OffsetOf
// Zero HEAD value is NOT valid - always call Init() to initialize a head
//
// before using it.
// always call Init() to initialize a head before using it.
type
Head
struct
{
type
Head
struct
{
// XXX needs to be created with .next = .prev = self
next
,
prev
*
Head
next
,
prev
*
Head
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment