libstdc++

EXC_BAD_ACCESS when using std::function w/ std::bind

女生的网名这么多〃 提交于 2019-12-07 16:56:04
问题 After upgrading to XCode 5 using std::function with std::bind appears to be generating EXC_BAD_ACCESS exceptions. It looks as if the __base pointer inside the implementation of std::function ends up being null, resulting in the bad access, but I'm not clear on why that would be the case. Does anyone have an insight into either what I'm doing wrong? Here is sample code that illustrates the problem. struct A { void foo(bool b) { std::cout << b << std::endl; } void go() { // ok auto a = std:

icpc C++11 with gcc stdlib

时光毁灭记忆、已成空白 提交于 2019-12-07 16:20:24
问题 I am using icpc (non optional) and I am compiling with -std=c++0x so I can use lambas. However when I do so it creates havok with gcc stdlib with features that one supports that the other doesn't. I have tried defining __GXX_EXPERIMENTAL_CXX0X__ but that didn't help. So ideally what I am asking for is the ability to use the c++0x language features with the C++03 stdlib. gcc 4.6 icc 12.1] EDIT example of error: /usr/include/c++/4.6.2/type_traits(74): error: identifier "constexpr" is undefined

Cannot get App built on OS X 10.9 to run on OS X 10.5

允我心安 提交于 2019-12-07 14:24:46
问题 Problem I've recently upgraded my build environment to Xcode 6.1.1, running on OS X 10.9, and now I'm having trouble getting my application running again under OS X Leopard, 10.5. For the target, Base SDK is set to OS X 10.6 , and OS X Deployment Target is set to OS X 10.5 . Inspecting the build logs shows that these settings are making their way through to the compilation and link phases (in the form of mmacosx-version-min=10.5 , export MACOSX_DEPLOYMENT_TARGET=10.5 , etc.) However, when I

custom built gcc 4.6.0 on ubuntu 11.04 links wrong libstdc++

六月ゝ 毕业季﹏ 提交于 2019-12-07 13:27:29
问题 my custom built gcc 4.6.0, installed in my home directory, on ubuntu 10.04, links the system libstdc++ instead of the custom built one, most of the time (as evidenced by ldd). to be more puzzling, using this newly built gcc, custom compiled openmpi libraries are linked correctly, and this is the only software i have compiled that behaves ok. does anybody have any explanation for this, or a workaround? thanks 回答1: Isn't there an option to statically link the libstdc into the gcc when you

What does libstdc++'s std::vector<bool>::data do?

≯℡__Kan透↙ 提交于 2019-12-07 04:34:19
问题 According to the standard, std::vector<bool> has no member function data() . However, the following snippet compiles fine with the latest GCC with libstdc++: #include <vector> int main () { std::vector<bool> v; v.data(); } If we try to use the result, it turns out the return type is void . Is this some gcc extension or a bug? If the former is true, what does it do? 回答1: My /usr/include/c++/4.8/bits/stl_bvector.h has: // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 464. Suggestion for new member

Unnecessary emptying of moved-from std::string

谁说我不能喝 提交于 2019-12-06 21:01:22
问题 Both libstdc++ and libc++ makes moved-from std::string object empty, even if the original stored string is short and short string optimization is applied. It seems to me that this emptying makes an additional and unnecessary runtime overhead . For instance, here is the move constructor of std::basic_string from libstdc++: basic_string(basic_string&& __str) noexcept : _M_dataplus(_M_local_data(), std::move(__str._M_get_allocator())) { if (__str._M_is_local()) traits_type::copy(_M_local_buf, _

incomplete types with std::map and std::variant

南笙酒味 提交于 2019-12-06 19:27:11
问题 Consider this simplified and very specific implementation of a recursive variant on top of std::variant : #include <map> #include <variant> struct recursive_tag; template <typename...> struct RecursiveVariant; template <> struct RecursiveVariant<int, std::map<int, recursive_tag>> : std::variant<int, std::map<int, RecursiveVariant<int, std::map<int, recursive_tag>>>> { using underlying = std::variant<int, std::map<int, RecursiveVariant<int, std::map<int, recursive_tag>>>>; using underlying:

C++11 standard libraries in libstdc++ on Mac

北战南征 提交于 2019-12-06 14:59:24
In a Xcode project which I currently work on, I am using C++11 with Apple LLVM 4.2 (clang) compiler, and using libstdc++ as my standard library, because I am using a library (NTL) which was not compiled with libc++ and so I must use libstdc++. When writing the following code: #include <regex> int main() { return 0; } It doesn't compile, by saying: 'regex' file not found And so I can't use any C++11 library with my libstdc++ (Tried <mutex> , <thread> aswell). Another I tried to take is to recompile NTL with cc and libc++, but that doesn't seem much to work. The following is some of the errors

EXC_BAD_ACCESS when using std::function w/ std::bind

那年仲夏 提交于 2019-12-05 21:56:38
After upgrading to XCode 5 using std::function with std::bind appears to be generating EXC_BAD_ACCESS exceptions. It looks as if the __base pointer inside the implementation of std::function ends up being null, resulting in the bad access, but I'm not clear on why that would be the case. Does anyone have an insight into either what I'm doing wrong? Here is sample code that illustrates the problem. struct A { void foo(bool b) { std::cout << b << std::endl; } void go() { // ok auto a = std::bind(&A::foo, this, std::placeholders::_1); a(true); // ok std::function<void(A*, bool)> b = std::bind(&A:

icpc C++11 with gcc stdlib

浪子不回头ぞ 提交于 2019-12-05 18:45:27
I am using icpc (non optional) and I am compiling with -std=c++0x so I can use lambas. However when I do so it creates havok with gcc stdlib with features that one supports that the other doesn't. I have tried defining __GXX_EXPERIMENTAL_CXX0X__ but that didn't help. So ideally what I am asking for is the ability to use the c++0x language features with the C++03 stdlib. gcc 4.6 icc 12.1] EDIT example of error: /usr/include/c++/4.6.2/type_traits(74): error: identifier "constexpr" is undefined static constexpr _Tp value = __v; ^ /usr/include/c++/4.6.2/type_traits(74): error: expected a ";"