Notes
This function is in beta test. Please help improve it in the issues
here.
ASAN:DEADLYSIGNAL ================================================================= ==35408==ERROR: AddressSanitizer: SEGV on unknown address 0x61e000000048 (pc 0x55f0189470e0 bp 0x7ffe642d5620 sp 0x7ffe642d5610 T0) ==35408==The signal is caused by a READ memory access. #0 0x55f0189470df in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const /usr/include/c++/7/bits/basic_string.h:176 #1 0x55f018947591 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const /usr/include/c++/7/bits/basic_string.h:211 #2 0x55f0189463d5 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (/out/package/test+0x313d5) #3 0x55f018944f4c in Book::operator=(Book&&) (/out/package/test+0x2ff4c) #4 0x55f01894283e in bookInventory::removeBook(int) /in/ex5.cpp:47 #5 0x55f01894b0cf in test4() /in/compile
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
JOJ Answer
Testing the removeBook method PASSED