我在这一行收到以下错误:
const short pcmSample = *reinterpret_cast<const short*>(*(buffer->index));
buffer
是类的对象accumlator
。
在这里,我试图将字节数组转换为短裤。代码抛出此运行时错误并终止。
class accumlator : public boost::circular_buffer<char>
{
public:
boost::circular_buffer<char>::iterator index;
};
我已将迭代器初始化为指向缓冲区的开头
并且index
是循环缓冲区的迭代器。
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&]: 断言 `m_it != 0' 失败。
我什至将它跟踪到文件 boost/circular_buffer/detail.hpp
断言条件检查 - 迭代器是否指向结束。如果它指向结束,那么它会抛出断言。
提前致谢。