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

怎样加入装修接单网站做网站的网络公司

怎样加入装修接单网站,做网站的网络公司,泰安网站建设定制公司,网站怎么找开发公司吗类型特性 类型特性定义一个编译时基于模板的结构&#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.ds6.com.cn/news/112460.html

相关文章:

  • 自己可以做类似拓者的网站吗镇江seo快速排名
  • 网站建设 验收意见国内免费b2b网站大全
  • 做暖暖免费网站肇庆seo优化
  • 网站制作哪个软件权重查询入口
  • 微信登录入口官网四川最好的网络优化公司
  • html网站标题怎么做seo优化网站的手段
  • 品牌建设完整版小红书seo关键词优化多少钱
  • 长春网站建设服务百度秒收录蜘蛛池
  • 长春哪有做网站公司百度竞价排名公式
  • 门户网站源码快速收录工具
  • 一品威客做的网站好用吗百度网站链接提交入口
  • 网站建设凭证一站式营销平台
  • 小学学校网站模板电脑培训学校在哪里
  • 祁东seo公司淘宝标题优化工具推荐
  • 写作网站投稿平台哪些平台可以发布推广信息
  • 怎么给别人做网站优化惠州seo排名收费
  • 视频号分销解决方案的特点临沂做网络优化的公司
  • 如何下载别人网站模板收录
  • 网站建设gzzctyi结构优化是什么意思
  • 什么做网站营销策划运营培训机构
  • 网站开发框架 c会计培训班多少钱
  • 怎么在虚拟空间做两个网站软文写作技巧及范文
  • 手机上怎么做自己卖菜的网站seo搜索培训
  • 在婚纱店做网站优化怎么开通网站
  • 能免费做婚礼邀请函的网站2022好用值得推荐的搜索引擎
  • 做微博网站好不好国外网站加速
  • css做网站国外网络推广
  • 做外贸网站卖什么货好呢网站建设报价明细表
  • 工作做网站深圳百度首页优化
  • seo排名优化哪里好山西seo优化公司