In MSVC 2015U3, the compiler is unable to inline some bsoncxx functions.
Try compiling the following with /O2 /W4 (warning level 4):
#include <bsoncxx/builder/stream/document.hpp> #include <bsoncxx/json.hpp> #include <iostream> using namespace bsoncxx::builder::stream; int main() { document doc; doc << "test" << "test"; auto doc_val = doc << finalize; std::cout << bsoncxx::to_json(doc_val.view()) << std::endl; }
Output:
1>ctest.cpp(13): warning C4714: function 'bsoncxx::v_noabi::document::value bsoncxx::v_noabi::builder::stream::key_context<bsoncxx::v_noabi::builder::stream::closed_context>::operator <<<const bsoncxx::v_noabi::builder::stream::finalize_type&>(T)' marked as __forceinline not inlined 1> with 1> [ 1> T=const bsoncxx::v_noabi::builder::stream::finalize_type & 1> ] 1> ..\bsoncxx/builder/stream/key_context.hpp(131): note: see declaration of 'bsoncxx::v_noabi::builder::stream::key_context<bsoncxx::v_noabi::builder::stream::closed_context>::operator <<' 1> Generating code 1>..\bsoncxx\document\value.hpp(109): warning C4714: function 'class bsoncxx::v_noabi::document::view __cdecl bsoncxx::v_noabi::document::value::view(void)const __ptr64' marked as __forceinline not inlined
- links to