libc++

Using libstdc++ compiled libraries with clang++ -stdlib=libc++

孤者浪人 提交于 2019-11-26 15:13:59
问题 I am working in C++ under Mac OS X (10.8.2) and I recently came up with the need of using C++11 features, which are available through the clang++ compiler using the libc++ stdlib. However, I also need to use some legacy library compiled and linked against libstdc++ (coming from MacPorts). In doing so, I got linking errors, since the headers of the legacy libraries using, e.g., std::string , required to be resolved against the std::__1::basic_string (i.e., the libc++ implementation of std:

How to compile/link Boost with clang++/libc++?

冷暖自知 提交于 2019-11-26 06:18:40
问题 The answer to this question Why can't clang with libc++ in c++0x mode link this boost::program_options example? states \"You need to rebuild boost using clang++ -stdlib=libc++.\" I\'m using MacOS Lion with clang v3.0. How do I build Boost v1.48.0 using clang and link it with libc++? Update: I\'ve created a user-config.jam file with the following: using clang-darwin ...which will build Boost with clang instead of gcc. How do I link with libc++ instead of libstdc++? 回答1: I didn't know how to do

What are the mechanics of short string optimization in libc++?

ε祈祈猫儿з 提交于 2019-11-26 03:24:00
This answer gives a nice high-level overview of short string optimization (SSO). However, I would like to know in more detail how it works in practice, specifically in the libc++ implementation: How short does the string have to be in order to qualify for SSO? Does this depend on the target architecture? How does the implementation distinguish between short and long strings when accessing the string data? Is it as simple as m_size <= 16 or is it a flag that is part of some other member variable? (I imagine that m_size or part of it might also be used to store string data). I asked this

Why can&#39;t clang with libc++ in c++0x mode link this boost::program_options example?

﹥>﹥吖頭↗ 提交于 2019-11-26 02:51:29
问题 Compiling this example code for boost::program_options: http://svn.boost.org/svn/boost/trunk/libs/program_options/example/first.cpp ...on MacOS Lion (10.7.2), using boost-1.48.0 installed with MacPorts: $ clang++ -v Apple clang version 3.0 (tags/Apple/clang-211.12) (based on LLVM 3.0svn) Target: x86_64-apple-darwin11.2.0 Thread model: posix $ clang++ -std=c++0x --stdlib=libc++ -lc++ -I/opt/local/include -L/opt/local/lib -lboost_program_options first.cpp -o first Undefined symbols for

std::unique_ptr with an incomplete type won&#39;t compile

▼魔方 西西 提交于 2019-11-26 01:44:51
问题 I\'m using the pimpl-idiom with std::unique_ptr : class window { window(const rectangle& rect); private: class window_impl; // defined elsewhere std::unique_ptr<window_impl> impl_; // won\'t compile }; However, I get a compile error regarding the use of an incomplete type, on line 304 in <memory> : Invalid application of \' sizeof \' to an incomplete type \' uixx::window::window_impl \' For as far as I know, std::unique_ptr should be able to be used with an incomplete type. Is this a bug in

What are the mechanics of short string optimization in libc++?

微笑、不失礼 提交于 2019-11-26 00:58:23
问题 This answer gives a nice high-level overview of short string optimization (SSO). However, I would like to know in more detail how it works in practice, specifically in the libc++ implementation: How short does the string have to be in order to qualify for SSO? Does this depend on the target architecture? How does the implementation distinguish between short and long strings when accessing the string data? Is it as simple as m_size <= 16 or is it a flag that is part of some other member

std::unique_ptr with an incomplete type won&#39;t compile

末鹿安然 提交于 2019-11-26 00:10:55
I'm using the pimpl-idiom with std::unique_ptr : class window { window(const rectangle& rect); private: class window_impl; // defined elsewhere std::unique_ptr<window_impl> impl_; // won't compile }; However, I get a compile error regarding the use of an incomplete type, on line 304 in <memory> : Invalid application of ' sizeof ' to an incomplete type ' uixx::window::window_impl ' For as far as I know, std::unique_ptr should be able to be used with an incomplete type. Is this a bug in libc++ or am I doing something wrong here? Alexandre C. Here are some examples of std::unique_ptr with