首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >::std::has_nothrow_default_constructor被移动/改变了吗?

::std::has_nothrow_default_constructor被移动/改变了吗?
EN

Stack Overflow用户
提问于 2012-12-17 06:40:31
回答 2查看 434关注 0票数 3

在尝试使用gcc 4.7.2的建造升压镜时,我遇到了这个错误,但奇怪的是,我看到了这份文件

::std::has_nothrow_default_constructor被移动/改变了吗?

代码语言:javascript
复制
In file included from /home/kfeng/src/mirror-lib/include/mirror/type_traits.hpp:20:0,
                 from /home/kfeng/src/mirror-lib/include/mirror/mirror_base.hpp:38,
                 from /home/kfeng/src/mirror-lib/include/mirror/mirror.hpp:16,
                 from /home/kfeng/src/mirror-lib/src/mirror/example/all_member_variables.cpp:10:
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_default_constructible.hpp:31:2: error: ‘has_nothrow_default_constructor’ is not a member of ‘std’
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_default_constructible.hpp:28:9: error: parse error in template argument list
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_default_constructible.hpp:31:43: error: expected ‘{’ before ‘::’ token
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_default_constructible.hpp:31:51: error: expected initializer before ‘||’ token
In file included from /home/kfeng/src/mirror-lib/include/mirror/type_traits.hpp:21:0,
                 from /home/kfeng/src/mirror-lib/include/mirror/mirror_base.hpp:38,
                 from /home/kfeng/src/mirror-lib/include/mirror/mirror.hpp:16,
                 from /home/kfeng/src/mirror-lib/src/mirror/example/all_member_variables.cpp:10:
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_copy_constructible.hpp:31:2: error: ‘has_nothrow_copy_constructor’ is not a member of ‘std’
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_copy_constructible.hpp:28:9: error: parse error in template argument list
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_copy_constructible.hpp:31:40: error: expected ‘{’ before ‘::’ token
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_copy_constructible.hpp:31:48: error: expected initializer before ‘||’ token
make[2]: *** [src/mirror/example/CMakeFiles/mirror-all_member_variables.dir/all_member_variables.cpp.o] Error 1
make[1]: *** [src/mirror/example/CMakeFiles/mirror-all_member_variables.dir/all] Error 2
make: *** [all] Error 2

使用Pubby在下面的注释回答

像这样的东西应该与gcc一起工作4.7.2 -我将提交一个补丁,让维护人员决定如何最好地处理它。

代码语言:javascript
复制
template <typename T>
 struct is_default_constructible
  : std::integral_constant<
        bool,
        ::std::has_trivial_default_constructor<T>::value ||
#if __cplusplus>=201103L 
        ::std::is_nothrow_default_constructible<T>::value ||
#else
        ::std::has_nothrow_default_constructor<T>::value ||
#endif
        mirror::_class::_<T>::has_default_ctr::value>
 { };
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-12-17 06:49:32

在C++11中,它被更改为std::is_nothrow_default_constructible,以便与命名更一致。

票数 6
EN

Stack Overflow用户

发布于 2012-12-17 09:46:55

您正在查看GCC 4.6.2的文档,但是使用GCC 4.7.2,所以它们不匹配也就不足为奇了。

这些性状用n3142重命名

请参阅我的https://stackoverflow.com/a/12716778/981959之前的答案,其中一些代码试图检测编译器支持的代码,尽管有评论说它不适用于libc++。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13909461

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档