c++ - How to compile a C++03 project that uses a C++11 library API? -


i required use shared library , api compiled using c++11. uses c++11 features std::mutex , std::shared_ptr in api. have no control on library a.

however, being required compile code using c++03 uses library a's api.

i pretty sure cannot done because compiler errors stating uses of std::mutex, std::shared_ptr, , others in api not found. (my understand is, if library didn't use c++11 specific types should able this.)

but want make sure there isn't not understanding need in order compile code against c++11 library a.

so question is, can compile code using c++03 against shared library , api uses c++11?

an api exposes at edges c++11-specific features won't usable c++03. 1 way work around build c++11 wrapper library converts c++11-specific inputs , outputs c++03-compatible types. example if original c++11 library returns std::shared_ptr api, wrapper library return boost::shared_ptr or raw pointer instead. "pimpl" idiom might helpful when implementing wrapper, e.g. if need make wrappers smart pointers can't allow application code see std::shared_ptr @ all.

but question has asked: why not enable c++11 existing code?


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -