代码中定义了一个map:
std::map<int64, std::vector<xmlrpc_c::value> > entrust;
key是int 类型,value是vector类型,vector中保存xmlrpc_c::value类型的值,xmlrpc_c是xmlrpc框架中的一个数据类型,xmlrpc_c::value类型在xmlrcp框架中是这样定义的
namespace xmlrpc_c {
class XMLRPC_LIBPP_EXPORTED value {
// This is a handle. You don't want to create a pointer to this;
// it is in fact a pointer itself.
public:
value();
// This creates a placeholder. It can't be used for anything, but
// holds memory. instantiate() can turn it into a real object.
value(xmlrpc_c::value const &value); // copy constructor
~value();
enum type_t {
// These are designed to be identical to the values for
// enum xmlrpc_type in the C library.
TYPE_INT = 0,
TYPE_BOOLEAN = 1,
TYPE_DOUBLE = 2,
TYPE_DATETIME = 3,
TYPE_STRING = 4,
TYPE_BYTESTRING = 5,
TYPE_ARRAY = 6,
TYPE_STRUCT = 7,
TYPE_C_PTR = 8,
TYPE_NIL = 9,
TYPE_I8 = 10,
TYPE_DEAD = 0xDEAD
};
type_t type() const;
xmlrpc_c::value&
operator=(xmlrpc_c::value const&);
bool
isInstantiated() const;
// The following are not meant to be public to users, but just to
// other Xmlrpc-c library modules. If we ever go to a pure C++
// implementation, not based on C xmlrpc_value objects, this shouldn't
// be necessary.
void
appendToCArray(xmlrpc_value * const arrayP) const;
void
addToCStruct(xmlrpc_value * const structP,
std::string const key) const;
xmlrpc_value *
cValue() const;
// Not to be confused with public 'cvalue' method that all the derived
// classes have.
value(xmlrpc_value * const valueP);
void
instantiate(xmlrpc_value * const valueP);
// Works only on a placeholder object created by the no-argument
// constructor.
xmlrpc_value * cValueP;
// NULL means this is merely a placeholder object.
protected:
void
validateInstantiated() const;
};
typedef std::vector<xmlrpc_c::value> carray;
class XMLRPC_LIBPP_EXPORTED value_array : public value {
public:
value_array(carray const& cvalue);
value_array(xmlrpc_c::value const baseValue);
// You can't cast to a vector because the compiler can't tell which
// constructor to use (complains about ambiguity). So we have this:
carray
vectorValueValue() const;
carray cvalue() const;
size_t
size() const;
};
在我写的代码中使用 it->second = value;方式更新value值,编译没有报错,执行时就会报错
std::vector<xmlrpc_c::value> value;
value.push_back(xmlrpc_c::value_int(order_no));
value.push_back(xmlrpc_c::value_int(hh));
value.push_back(xmlrpc_c::value_int(mm));
std::map<int64, int>::iterator it_cancel = cancel_entrust.find(order_no);
if (it_cancel == cancel_entrust.end())
cancel_entrust.insert(std::make_pair(order_no, stock_code));
else
it_cancel->second = stock_code;
// entrust_mtx.lock();
std::map<int64, std::vector<xmlrpc_c::value> >::iterator it = entrust.find(order_no);
//map中不存在
if (it == entrust.end())
{
entrust.insert(std::make_pair(order_no, value));
}
else
{
it->second = value;
}
执行时,更新map中value值就会报错 报错信息为 Assigning to already instantiated xmlrpc_c::value

这个不知道是什么问题,大概猜测是没有重写操作符,但是重写操作符只与key值有关,也不知道如何去重写操作符,
求各位大 牛看一下,为什么更新map中的value值就会报错