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

Vector type and iterator opportunities #269

Open
38dh91 opened this issue Mar 6, 2024 · 2 comments
Open

Vector type and iterator opportunities #269

38dh91 opened this issue Mar 6, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@38dh91
Copy link

38dh91 commented Mar 6, 2024

Good day!

I have a snippet of code like this:

dockNode := imgui.InternalDockBuilderGetNode(dockId)
tabs := dockNode.TabBar().Tabs()

Method Tabs() returns Vector type and in my mind such type must have some type of iterator, but it isn't.

Can you help me to realize how can I use this type to iterate over all TabItems in TabBar?

Thank you in advance!

@gucio321
Copy link
Collaborator

Hi
sorry I didn't respond - I had to miss this issue somehow.

I think you should do something like this:

        slice := []int{1, 2, 3, 4, 5}
        ptr := &slice[0]
        convertedSlice := (*[5]int)(unsafe.Pointer(ptr))[:]
        fmt.Println(convertedSlice) 

I'll try to add it to cimgui-go

@gucio321
Copy link
Collaborator

I've tried to add a generic version for that and there is a problem:
to add some iterator I need to know base type, when our type T is in fact a pointer. I've tried to make it a base type and Data field just a pointer to T but I found out that it sometimes can be string (char*) and its quite difficult to find out what to do then.
I'll think about that

@gucio321 gucio321 added the enhancement New feature or request label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants