boost :: serialization :: shared_ptr_helper出错 [英] Error with boost::serialization::shared_ptr_helper
问题描述
通过,我得到了错误:
/usr/local/include/boost/serialization/shared_ptr_helper.hpp:182:20: error: no matching function for
call to 'std::map<const void*, std::shared_ptr<void>, std::less<const void*>, std::allocator<std::
pair<const void* const, std::shared_ptr<void> > > >::insert(std::pair<const void*, std::
shared_ptr<const bagel::Atom> >)'
result = m_o_sp->insert(std::make_pair(oid, s));
怎么了? std和boost的版本都是最新的.
What's wrong?? The version of std and boost are both the newest.
推荐答案
您当然不会通过包含"获得该内容.我知道这一点,因为bagel::Atom
不是提升的一部分.
You certainly do not get that "by including". I know this, because bagel::Atom
is not a part of boost.
您根本无法期望在没有显式强制转换(static_pointer_cast
?)的情况下将shared_ptr<const bagel::Atom> >
存储到std::shared_ptr<void>
中.
You simply cannot expect to store a shared_ptr<const bagel::Atom> >
into a std::shared_ptr<void>
without an explicit cast (static_pointer_cast
?).
使用
std::map<void*, std::shared_ptr<void> >
是一种巨大的设计气味.您绝对不能期望其中任何一个会自动序列化(因为void
如何被有效地序列化?)
is a huge design smell though. You can definitely not expect any of that to be automatically serialized anyway (because, how would void
be usefully serialized?)
这篇关于boost :: serialization :: shared_ptr_helper出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!