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

Bug report exercise 16.12 #211

Open
tianshihao opened this issue Oct 10, 2022 · 0 comments
Open

Bug report exercise 16.12 #211

tianshihao opened this issue Oct 10, 2022 · 0 comments

Comments

@tianshihao
Copy link

Exercise information

Exercise 16.12

Question or Bug

Bug, end() and cend() member function of Blob have incorrect boundary check condition.

e.g.

#include "ex16_12_blob.h"
#include <iostream>
#include <string>

int main()
{
    Blob<std::string> sb1{"a", "b", "c"};

    auto p{sb1.cbegin()};
    std::cout << *p << std::endl;
}

Code above will throw exception as follow:

terminate called after throwing an instance of 'std::out_of_range'
  what():  dereference past end

And the member function end() has the same problem.

Your enviroment information

  • System: Ubuntu 20.04
  • Compiler version/IDE: gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
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

1 participant