exception : bson::assertion at memory location 0x0026F500

C++语言 码拜 10年前 (2015-07-10) 1283次浏览 0个评论

exception : bson::assertion at memory location 0x0026F500

代码如下
#pragma once

#include <cstdlib>
#include <memory>
#include <iostream>
#include <sstream>
#include <boost/utility.hpp>

#include “stringdata.h”

namespace bson {

using std::string;
using std::stringstream;

class assertion : public std::exception {
public:
assertion( unsigned u , const string& s )
: id( u ) , msg( s ) {
stringstream ss;
ss << “BsonAssertion id: ” << u << ” ” << s;
full = ss.str();
}

virtual ~assertion() throw() {}

virtual const char* what() const throw() { return full.c_str(); }

unsigned id;
string msg;
string full;
};

#if !defined(assert)
inline void assert(bool expr) {
if(!expr) {
throw bson::assertion( 0 , “assertion failure in bson library” );
}
}
#endif
#if !defined(uassert)
inline void uasserted(unsigned msgid, std::string s) {
throw bson::assertion( msgid , s );
}

inline void uassert(unsigned msgid, std::string msg, bool expr) {
if( !expr )
uasserted( msgid , msg );
}
inline void msgasserted(int msgid, const char *msg) {
throw bson::assertion( msgid , msg );
}
inline void msgasserted(int msgid, const std::string &msg) { msgasserted(msgid, msg.c_str()); }
inline void massert(unsigned msgid, std::string msg, bool expr) {
if(!expr) {
std::cout << “assertion failure in bson library: ” << msgid << “” “” << msg << std::endl;
throw bson::assertion( msgid , msg );
}
}
#endif
}

 
已解决 来人拿分

20分

崩溃的时候在弹出的对话框按相应按钮进入调试,按Alt+7键查看Call Stack里面从上到下列出的对应从里层到外层的函数调用历史。双击某一行可将光标定位到此次调用的源代码或汇编指令处,看不懂时双击下一行,直到能看懂为止。

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明exception : bson::assertion at memory location 0x0026F500
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!