2014-07-11 57 views
1

iso 20.9.4.3类型属性[meta.unary.prop]不完全支持g ++的libstdC++ - v3;例如:is_trivially_copyable/constructible等支持铿锵++和g ++

wget -O - https://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/include/std/type_traits 2>/dev/null | grep "still unimplemented" 


    // is_trivially_copyable (still unimplemented) 
    /// is_trivially_constructible (still unimplemented) 
    /// is_trivially_default_constructible (still unimplemented) 
    /// is_trivially_copy_constructible (still unimplemented) 
    /// is_trivially_move_constructible (still unimplemented) 
    /// is_trivially_assignable (still unimplemented) 
    /// is_trivially_copy_assignable (still unimplemented) 
    /// is_trivially_move_assignable (still unimplemented 

因此,至少据我了解,基于gcc安装的clang构建将继承这种缺乏实现;至少

clang version 3.5.0 (212792) 

我建只是一些小时前

g++ (Debian 4.8.3-3) 4.8.3 

(但不知何故使用GCC-4.9包括但)不支持提到的那些类型的特征。


但不知何故Coliru http://coliru.stacked-crooked.com/

具有铛安装,而如果调用与

clang++ -std=c++11 -stdlib=libc++ -O2 -Wall -Wextra -pedantic -pthread -pedantic-errors main.cpp -lm -lsupc++ && ./a.out 

编译例如这

http://en.cppreference.com/w/cpp/types/is_constructible

例如无投诉。

所以必须有编译或设置clang的方法,至少在Linux上,头文件也支持这些类型特征,但未被libstdC++实现。


此外,LLVM编译具有这个

http://libcxx.llvm.org/type_traits_design.html

总结,但我不知道如何使用这些 “__” 内部函数;他们显然没有住std :: nor ::;

-

所以 - 如何设置或在Linux上配置近LLVM /铛使铛++拥有最那些集型性状的可用?

附录在respose的评论

clang++ -std=c++11 -stdlib=libc++ -O2 -Wall -Wextra -pedantic -pthread -pedantic-errors test_type_traits.cxx -lm -lsupc++ 

test_type_traits.cxx:1:10:

致命错误: 'iostream的' 找不到文件 的#include ^ 1错误产生。

+0

确实有这些类型的特征有一个叫做libC++的STL,试过了吗?这是“clangish”。否则,clang将使用libstdC++。你实际上可以看到coliru使用它。 – user1095108

+0

它存在,但我的安装上甚至没有。 “ – Solkar

+0

”libC++是苹果OS X上100%完整的C++ 11实现。“如果它没有它不会100%完成。也许coliru正在Apple上进行编译,但无论如何,你都可以在命令行上看到它正在与它链接。 – user1095108

回答

0

一个只需简单地安装的libC++ 完全

http://libcxx.llvm.org/

那建造和安装就像一个魅力现在铛当调用像

clang++ -std=c++11 -stdlib=libc++ <other arguments>