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

制作书签的作文太极seo

制作书签的作文,太极seo,佛山网站建设公司哪家好,柯桥做网站有哪些公司类型特性 类型特性定义一个编译时基于模板的结构&#xff0c;以查询或修改类型的属性。 试图特化定义于 <type_traits> 头文件的模板导致未定义行为&#xff0c;除了 std::common_type 可依照其所描述特化。 定义于<type_traits>头文件的模板可以用不完整类型实例…

类型特性


类型特性定义一个编译时基于模板的结构,以查询或修改类型的属性。

试图特化定义于 <type_traits> 头文件的模板导致未定义行为,除了 std::common_type 可依照其所描述特化。

定义于<type_traits>头文件的模板可以用不完整类型实例化,除非另外有指定,尽管通常禁止以不完整类型实例化标准库模板。
 

类型修改

类型修改模板通过应用修改到模板参数,创建新类型定义。结果类型可以通过成员 typedef type 访问。

从给定类型移除 const 或/与 volatile 限定符

std::remove_cv, 
std::remove_const, 
std::remove_volatile

template< class T >
struct remove_cv;

(1)(C++11 起)

template< class T >
struct remove_const;

(2)(C++11 起)

template< class T >
struct remove_volatile;

(3)(C++11 起)

提供与 T 相同的成员 typedef type ,除了其最顶层 cv 限定符被移除。

1) 移除最顶层 const 、最顶层 volatile 或两者,若存在。

2) 移除最顶层 const

3) 移除最顶层 volatile

成员类型

名称定义
type无 cv 限定符的 T

辅助类型

template< class T >
using remove_cv_t       = typename remove_cv<T>::type;

(C++14 起)

template< class T >
using remove_const_t    = typename remove_const<T>::type;

(C++14 起)

template< class T >
using remove_volatile_t = typename remove_volatile<T>::type;

(C++14 起)

 可能的实现

template< class T >
struct remove_cv {typedef typename std::remove_volatile<typename std::remove_const<T>::type>::type type;
};template< class T > struct remove_const          { typedef T type; };
template< class T > struct remove_const<const T> { typedef T type; };template< class T > struct remove_volatile             { typedef T type; };
template< class T > struct remove_volatile<volatile T> { typedef T type; };

调用示例

#include <iostream>
#include <type_traits>int main()
{typedef std::remove_cv<const int>::type CVtype1;typedef std::remove_cv<volatile int>::type CVtype2;typedef std::remove_cv<const volatile int>::type CVtype3;typedef std::remove_cv<const volatile int*>::type CVtype4;typedef std::remove_cv<int * const volatile>::type CVtype5;std::cout << "std::is_same<int, std::remove_cv<const int>::type>::value:    "<< (std::is_same<int, CVtype1>::value ? "passed" : "failed") << std::endl;std::cout << "std::is_same<int, std::remove_cv<volatile int>::type>::value: "<< (std::is_same<int, CVtype2>::value ? "passed" : "failed") << std::endl;std::cout << "std::is_same<int, std::remove_cv<const volatile int>::type>::value:"<< (std::is_same<int, CVtype3>::value ? "passed" : "failed") << std::endl;std::cout << "std::is_same<const volatile int*, std::remove_cv<const volatile int*>::type>::value:  "<< (std::is_same<const volatile int*, CVtype4>::value ? "passed" : "failed") << std::endl;std::cout << "std::is_same<int*, std::remove_cv<int * const volatile>::type>::value: "<< (std::is_same<int*, CVtype5>::value ? "passed" : "failed") << std::endl;std::cout << std::endl;typedef std::remove_const<const int>::type Ctype1;typedef std::remove_const<volatile int>::type Ctype2;typedef std::remove_const<const volatile int>::type Ctype3;typedef std::remove_const<const volatile int*>::type Ctype4;typedef std::remove_const<int * const volatile>::type Ctype5;std::cout << "std::is_same<int, std::remove_const<const int>::type>::value:    "<< (std::is_same<int, Ctype1>::value ? "passed" : "failed") << std::endl;std::cout << "std::is_same<int, std::remove_const<volatile int>::type>::value: "<< (std::is_same<int, Ctype2>::value ? "passed" : "failed") << std::endl;std::cout << "std::is_same<int, std::remove_const<const volatile int>::type>::value:"<< (std::is_same<int, Ctype3>::value ? "passed" : "failed") << std::endl;std::cout << "std::is_same<const volatile int*, std::remove_const<const volatile int*>::type>::value:  "<< (std::is_same<const volatile int*, Ctype4>::value ? "passed" : "failed") << std::endl;std::cout << "std::is_same<int*, std::remove_const<int * const volatile>::type>::value: "<< (std::is_same<int*, Ctype5>::value ? "passed" : "failed") << std::endl;std::cout << std::endl;typedef std::remove_volatile<const int>::type Vtype1;typedef std::remove_volatile<volatile int>::type Vtype2;typedef std::remove_volatile<const volatile int>::type Vtype3;typedef std::remove_volatile<const volatile int*>::type Vtype4;typedef std::remove_volatile<int * const volatile>::type Vtype5;std::cout << "std::is_same<int, std::remove_volatile<const int>::type>::value:    "<< (std::is_same<int, Vtype1>::value ? "passed" : "failed") << std::endl;std::cout << "std::is_same<int, std::remove_volatile<volatile int>::type>::value: "<< (std::is_same<int, Vtype2>::value ? "passed" : "failed") << std::endl;std::cout << "std::is_same<int, std::remove_volatile<const volatile int>::type>::value:"<< (std::is_same<int, Vtype3>::value ? "passed" : "failed") << std::endl;std::cout << "std::is_same<const volatile int*, std::remove_volatile<const volatile int*>::type>::value:  "<< (std::is_same<const volatile int*, Vtype4>::value ? "passed" : "failed") << std::endl;std::cout << "std::is_same<int*, std::remove_volatile<int * const volatile>::type>::value: "<< (std::is_same<int*, Vtype5>::value ? "passed" : "failed") << std::endl;std::cout << std::endl;return 0;
}

输出

std::is_same<int, std::remove_cv<const int>::type>::value:    passed
std::is_same<int, std::remove_cv<volatile int>::type>::value: passed
std::is_same<int, std::remove_cv<const volatile int>::type>::value:passed
std::is_same<const volatile int*, std::remove_cv<const volatile int*>::type>::value:  passed
std::is_same<int*, std::remove_cv<int * const volatile>::type>::value: passedstd::is_same<int, std::remove_const<const int>::type>::value:    passed
std::is_same<int, std::remove_const<volatile int>::type>::value: failed
std::is_same<int, std::remove_const<const volatile int>::type>::value:failed
std::is_same<const volatile int*, std::remove_const<const volatile int*>::type>::value:  passed
std::is_same<int*, std::remove_const<int * const volatile>::type>::value: failedstd::is_same<int, std::remove_volatile<const int>::type>::value:    failed
std::is_same<int, std::remove_volatile<volatile int>::type>::value: passed
std::is_same<int, std::remove_volatile<const volatile int>::type>::value:failed
std::is_same<const volatile int*, std::remove_volatile<const volatile int*>::type>::value:  passed
std::is_same<int*, std::remove_volatile<int * const volatile>::type>::value: failed

http://www.15wanjia.com/news/190236.html

相关文章:

  • 建一个收费网站做网站怎么购买主机
  • 购物网站代码什么平台打广告比较好免费的
  • 自主网站建设中华住房和城乡建设局网站
  • 网站建设mingxinsh校园跑腿小程序搭建
  • 网站建设业务流程西宁专业制作网站
  • 怎么做企业功能网站免费定制网页
  • 沧州网站建设公司翼马易优cms二次开发
  • 网站网站代理怎么做做英文网站需要多少
  • 网站开发一个月南昌网站建设哪里好
  • 佛山专业做网站的公司动画制作专业大学排名
  • 四川住房和城乡建设厅网站不能打开asp网站制作
  • dede 网站模板wordpress 文章间距
  • 做网站工作量怎么算网站被k怎么查
  • 万网一个ip建立多个网站项目网格化管理
  • 什么网站可以免费推广北京建站管理系统开发
  • 网站设计哪家强学校网站建设问卷调查
  • 欧美 电台 网站模板4怎样创建基本的网站
  • 怎么让自己做的网站别人可以访问域名有wordpress
  • 企业站seo哪家好济南百度整站seo推广
  • 营销型网站制作平台东莞品牌网站设计
  • 商城网站建设框架建设部网站监理公告
  • 快速建站套餐机票网站手机版建设
  • html5好的网站模板模板网页设计视频
  • 信誉比较好的商家可做网站crm客户关系管理论文
  • 龙华区深圳北站一起做网店的类似网站
  • 怎么用代码创建网站教程合肥小程序建设
  • 网站开发虚拟主机管理系统阿里云如何购买域名
  • 一个空间能放几个网站学网页设计在哪学
  • 佛山公司建网站竞价推广出价多少合适
  • 制作网站基本步骤开源商城小程序