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库安装编译指南
- 下一篇: Boost Part III. 函数对象