checked_delete问题: Beyond the C++ STL: an introduction to boostdeleter::do_it
生活随笔
收集整理的这篇文章主要介绍了
checked_delete问题: Beyond the C++ STL: an introduction to boostdeleter::do_it
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
环境:
Visual studio 2017
boost库编译选项: msvc141,multi,win64,debug,shared
demo工程设置: debug, win32
问题源:
《Beyond the C++ STL: an introduction to boost》书上Part I, Library 3, checked_delete章节
如果把 deleter.h, deleter.cpp, to_be_deleted.h三个文件内容整合到一个文件里,
编译后会提示 " warning C4150: 删除指向不完整“to_be_deleted”类型的指针;没有调用析构函数"
运行后调用 deleter::do_it 时会间接调用到 ~to_be_deleted()。
调用 deleter::delete_it 时则不会间接调用到 ~to_be_deleted()。
最后调用完 ~to_be_deleted()程序结束时才报一个异常错误。
很奇怪的地方啊!看来是编译器工作方式的不同导致的吧。。。
总结
以上是生活随笔为你收集整理的checked_delete问题: Beyond the C++ STL: an introduction to boostdeleter::do_it的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: boost库安装编译指南
- 下一篇: 去除C++中string前面和后面的空白