Skip to content

Scene/unit iterator things fix#18

Merged
CoraBlack merged 5 commits intogkit-org:scene/unitfrom
17-qxm:scene/unit
Feb 21, 2026
Merged

Scene/unit iterator things fix#18
CoraBlack merged 5 commits intogkit-org:scene/unitfrom
17-qxm:scene/unit

Conversation

@17-qxm
Copy link
Copy Markdown
Contributor

@17-qxm 17-qxm commented Feb 19, 2026

No description provided.

@CoraBlack
Copy link
Copy Markdown
Contributor

Don't imply your code in header files

@17-qxm
Copy link
Copy Markdown
Contributor Author

17-qxm commented Feb 20, 2026

Don't imply your code in header files

Ok I will fix it soon.

Comment on lines +259 to +270
// Why this part didn't use auto, because it need to have a const_iterator use
// but auto could not allow two same function but with different return
// but begin() and end() need those two return
// So I will not change it
iterator begin() {
return iterator(this, 0);
}

iterator end() {
return iterator(this, active_index_cache.size());
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code style

Comment on lines +320 to +345
const_iterator begin() const{
const_cast<Unit*>(this);
return const_iterator(this, 0);
}

const_iterator end() const {
const_cast<Unit*>(this);
return const_iterator(this, active_index_cache.size());
}

const_iterator cbegin() const { return begin(); }
const_iterator cend() const { return end(); }

public:
// This is a reverse iterator, implemented using std::reverse_iterator.
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;

reverse_iterator rbegin() { return reverse_iterator(end()); }
reverse_iterator rend() { return reverse_iterator(begin()); }

const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }

const_reverse_iterator crbegin() const { return rbegin(); }
const_reverse_iterator crend() const { return rend(); }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code style

@CoraBlack CoraBlack merged commit b7a08b1 into gkit-org:scene/unit Feb 21, 2026
10 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in libgkit-dev-plan Feb 21, 2026
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