I get the following error at this line:
const short pcmSample = *reinterpret_cast<const short*>(*(buffer->index));
buffer
is an object of class accumlator
.
Here I am trying to convert a byte array into shorts. The code throws this runtime error and terminates.
class accumlator : public boost::circular_buffer<char>
{
public:
boost::circular_buffer<char>::iterator index;
};
i have initialized the iterator to point to begin of buffer
and index
is a iterator to circular buffer.
boost::cb_details::iterator::reference boost::cb_details::iterator::operator*() const [with Buff = boost::circular_buffer, Traits = boost::cb_details::nonconst_traits >, boost::cb_details::iterator::reference = char&]: Assertion `m_it != 0' failed.
i have even tracked this to the file boost/circular_buffer/detail.hpp
the assert condition checks - if iterator is pointing to end. if it is pointing to end then it throws the assert.
Thanks in advance.