Skip to content

Bug report exercise 16.12 #211

@tianshihao

Description

@tianshihao

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions