当前位置: 首页 > news >正文

wordpress商城安装教程胶州网站优化价格

wordpress商城安装教程,胶州网站优化价格,国外做农产品有名的网站,功能型网站指定该类型对象可以从右值构造 指定该类型的实例可以从一个右值实参构造。 要求 以下情况下,类型 T 满足可移动构造 (MoveConstructible) : 给定 T 类型的右值表达式 rv任意标识符 u 下列表达式必须合法且拥有其指定的效果 表达式后条件T u rv;u…

指定该类型对象可以从右值构造

指定该类型的实例可以从一个右值实参构造。

要求

以下情况下,类型 T 满足可移动构造 (MoveConstructible)

给定

  • T 类型的右值表达式 rv
  • 任意标识符 u

下列表达式必须合法且拥有其指定的效果

表达式后条件
T u = rv;u 的值等于 rv 在初始化前的值。rv 的新值未指明。
T(rv)T(rv) 的值等于 rv 在初始化前的值。rv 的新值未指明。

注解

类不必为满足此要求而实现移动构造函数:接收 const T& 实参的复制构造函数也能绑定右值表达式。

可移动构造 (MoveConstructible) 类实现了移动构造函数,则它亦可实现移动语义,以从“构造后 rv 的值未指明”的事实中获利。

调用示例

#include <iostream>
#include <type_traits>//编译器生成默认构造函数
struct A
{
};struct B
{std::string str; // 成员拥有非平凡默认构造函数
};struct C
{std::string str; // 成员拥有非平凡默认构造函数C() throw (int) //构造函数抛异常{}
};struct MyClass
{int ma;int mb;MyClass(): ma(101), mb(102){std::cout << this << "  " << __FUNCTION__ << " " << __LINE__<< " a:" << ma << " b:" << mb<< std::endl;}MyClass(int a, int b): ma(a), mb(b){std::cout << this << "  " << __FUNCTION__ << " " << __LINE__<< " a:" << ma << " b:" << mb<< std::endl;}MyClass(const MyClass &obj){this->ma = obj.ma;this->mb = obj.mb;std::cout << this << "  " << __FUNCTION__ << " " << __LINE__<< " a:" << ma << " b:" << mb<< std::endl;}MyClass(MyClass &&obj){this->ma = obj.ma;this->mb = obj.mb;std::cout << this << "  " << __FUNCTION__ << " " << __LINE__<< " a:" << ma << " b:" << mb<< std::endl;}
};int main()
{std::cout << std::boolalpha;std::cout << "std::is_move_constructible<int>::value: "<< std::is_move_constructible<int>::value << std::endl;std::cout << "std::is_trivially_move_constructible<int>::value: "<< std::is_trivially_move_constructible<int>::value << std::endl;std::cout << "std::is_nothrow_move_constructible<int>::value: "<< std::is_nothrow_move_constructible<int>::value << std::endl;std::cout << std::endl;std::cout << "std::is_move_constructible<A>::value: "<< std::is_move_constructible<A>::value << std::endl;std::cout << "std::is_trivially_move_constructible<A>::value: "<< std::is_trivially_move_constructible<A>::value << std::endl;std::cout << "std::is_nothrow_move_constructible<A>::value: "<< std::is_nothrow_move_constructible<A>::value << std::endl;std::cout << std::endl;std::cout << "std::is_move_constructible<B>::value: "<< std::is_move_constructible<B>::value << std::endl;std::cout << "std::is_trivially_move_constructible<B>::value: "<< std::is_trivially_move_constructible<B>::value << std::endl;std::cout << "std::is_nothrow_move_constructible<B>::value: "<< std::is_nothrow_move_constructible<B>::value << std::endl;std::cout << std::endl;std::cout << "std::is_move_constructible<C>::value: "<< std::is_move_constructible<C>::value << std::endl;std::cout << "std::is_trivially_move_constructible<C>::value: "<< std::is_trivially_move_constructible<C>::value << std::endl;std::cout << "std::is_nothrow_move_constructible<C>::value: "<< std::is_nothrow_move_constructible<C>::value << std::endl;std::cout << std::endl;//T u = rv; u 的值等于 rv 在初始化前的值。rv 的新值未指明。MyClass myClass1 = std::move(MyClass(101, 102));//T(rv) T(rv) 的值等于 rv 在初始化前的值。rv 的新值未指明。MyClass(std::move(MyClass(101, 102)));return 0;
}

输出

std::is_move_constructible<int>::value: true
std::is_trivially_move_constructible<int>::value: true
std::is_nothrow_move_constructible<int>::value: truestd::is_move_constructible<A>::value: true
std::is_trivially_move_constructible<A>::value: true
std::is_nothrow_move_constructible<A>::value: truestd::is_move_constructible<B>::value: true
std::is_trivially_move_constructible<B>::value: false
std::is_nothrow_move_constructible<B>::value: truestd::is_move_constructible<C>::value: true
std::is_trivially_move_constructible<C>::value: false
std::is_nothrow_move_constructible<C>::value: true0x61fe78  MyClass 35 a:101 b:102
0x61fe70  MyClass 53 a:101 b:102
0x61fe88  MyClass 35 a:101 b:102
0x61fe80  MyClass 53 a:101 b:102

http://www.yayakq.cn/news/561997/

相关文章:

  • 昆明网站外包it行业的现状及发展前景
  • 企业官方网站建设教程娱乐城网站开发
  • 图书网站开发数据库的建立企业logo标志设计公司
  • 微网站界面尺寸装修风格大全2023新款
  • 网站建设放在什么科目网页设计教程教学目的
  • 网站建设制作报价方案上海城乡建设管理局网站保障房板块
  • 营销型网站的三元素城乡住房和城乡建设网站查询
  • 周口集团网站建设百度总部
  • 网站建设及维护费用成立公司注意事项
  • 洛阳市做网站贴吧购物网站的后台做哪些东西
  • 在线教学网站开发番禺制作网站系统
  • 容桂销售型网站建设扫码支付个人商城网站开发免费
  • 本地网站建设视频教程东莞网络推广运营企业
  • 滁州网站建设哪个好点aspcms网站打不开
  • seo网站推广工作内容哪里建设网站
  • 建设网站挣钱高端人才招聘网站
  • 移动电商网站包装设计网站排行榜
  • 惠州做棋牌网站建设多少钱徐州手机网站建设
  • 西山区建设局网站免费网站建设范例
  • 有效推广网站毕业设计做 什么网站好
  • 生活服务网站开发与设计有专门做礼品的网站吗
  • 百度能收录的免费网站做网站的桔子什么
  • 网页设计师多少钱一个月苏州网站优化推广
  • 做山西杂粮的网站江苏seo和网络推广
  • 网站推广策略和营销策略做网站 接单
  • 网站建设的方法步骤百度关键词价格查询
  • 怎么写网站建设维护推广合同厦门网络推广公司
  • 做网站可以临摹吗辽宁建设工程信息网新点
  • 北京做兼职从哪个网站好百度网址浏览大全
  • 南京网站做的好的公司西安电商平台网站