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

template_iterator iterator do not always return a value #7

Closed
Dllieu opened this issue Oct 17, 2017 · 1 comment
Closed

template_iterator iterator do not always return a value #7

Dllieu opened this issue Oct 17, 2017 · 1 comment

Comments

@Dllieu
Copy link

Dllieu commented Oct 17, 2017

Hello,

Is it intended?

            iterator begin()
            {
                for (EntryPointer it = entries;; ++it)
                {
                    if (it->has_value())
                        return { it };
                }

                // No return value here
            }

I believe it should at least return end() or cend() depending of the constness of the iterator

see #8

@skarupke
Copy link
Owner

The loop has no exit condition, so you can't get down there. The only way to exit the loop is through the return statement. You will always hit the it->has_value() case because there is a special entry at the end of the table that stops iteration.

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

No branches or pull requests

2 participants