我有一个对象缓冲区实现它看起来像这样:无效指针参数,通过缓冲
class obj_buffer_t
{
public:
obj_buffer_t(char *heap, size_t size, size_t cnt);
// Some other stuff
private:
// Some other stuff
};
的record_objbuf创建为静态缓冲区:
static obj_buffer_t::buffer_t<obj_buffer_min_heap_size_t< sizeof(Record_XY), RECORD_SIZE>::result> record_buffer;
obj_buffer_t record_objbuf(record_buffer.heap, sizeof record_buffer.heap, RECORD_SIZE);
在我的节目,我想读记录并在这个缓冲区中创建它们,但我该如何调用我的方法?
的方法签名如下:
Record * getRecord(unsigned & addr, Info & info, void * objbuf = NULL);
我的电话:
record = tm.getRecord(p, info, static_cast<obj_buffer_t *>(record_objbuf));
编译器给我的错误:无效的static_cast从obj_buffer_t
型,将obj_buffer_t*
如果我不去使用一个演员,我得到:
没有匹配的功能拨打getRecord(uint32_t&, Info&, obj_buffer_t&)
我在做什么错在这里?
Thx!
我不平均的方式是说这个,但它似乎对我来说,你是与一些高级C++特性掌握之前,搞乱所需的基础知识。 – StoryTeller