From 2ce4c46c710cce553a5a059dda83fdf72a038a46 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 11 Sep 2023 19:13:42 +0800 Subject: [PATCH] 1 --- listhead.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/listhead.go b/listhead.go index d192eb8..3a6b975 100644 --- a/listhead.go +++ b/listhead.go @@ -74,6 +74,16 @@ func (this *ListHead) Next() *ListHead { return this.next } +func (this *ListHead) Size() int32 { + num := int32(0) + this.ForEach_r( + func (data interface{}) bool { + num++ + return true + }) + return num +} + func (this *ListHead) ForEachFrom(from *ListHead, cb ListHead_Foreach_Func) { for pos := from; pos != this; pos = pos.next {