已 ::std::has_nothrow_default_constructor 已被移动/更改
has ::std::has_nothrow_default_constructor been moved/changed?
在尝试使用 gcc 4.7.2 构建提升镜像时,我遇到了这个错误,但奇怪的是,我看到了这个文档。
::std::has_nothrow_default_constructor
是否被移动/更改?
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 - 我将提交一个补丁,让维护者决定如何最好地处理它。
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>
{ };
在 C++11 中,它被更改为 std::is_nothrow_default_constructible
以更符合命名。
您正在查看GCC 4.6.2的文档,但使用的是GCC 4.7.2,因此它们不匹配也就不足为奇了。
性状由 n3142 重命名
请参阅我以前的答案 https://stackoverflow.com/a/12716778/981959 一些代码,这些代码试图检测编译器支持哪个代码,尽管有评论说它不适用于libc ++。
相关文章:
- 将对象移动到std::shared_ptr
- 何时在引用或唯一指针上使用移动语义
- 如何在Qt C++中更改光标
- 为什么++(*p)更改指针值
- 可以使用移动语义更改或改进此C++代码吗?
- 为什么 std::move 不将默认移动构造函数中的源变量更改为默认值?
- 如果您向前移动,如何更改屏幕,如果向后移动,如何看到较旧的东西?
- 如何在基于范围的 for 循环中更改(向前/向后移动)迭代器?
- 在OpenGL中,如何将鼠标跟随更改为鼠标单击,拖动并移动释放?
- 在C ++中,当手指在触摸屏上移动时如何更改标签文本
- Qt 移动光标不再更改选择边界
- 移动数组指针未更改开始的地址
- libstdc++已弃用;移动到libc++[-Wdeprecated],但是更改会产生编译错误
- 已 ::std::has_nothrow_default_constructor 已被移动/更改
- 制作贪吃蛇游戏。检测到移动后,我无法更改屏幕。C++
- C++11:执行移动操作以更改地址
- Arduino代码:移动位似乎将数据类型从int更改为long
- 如何知道在单独类中创建的 QGraphicsItem 是否已在场景中移动(更改其位置)?
- Q设置:移动/更改现有Q设置对象的范围/位置
- 如何在指定的注册表值更改时在ATL ActiveX控件中获取事件通知以用作windows移动ActiveX控件