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

试用型网站怎么做google chrome官网下载

试用型网站怎么做,google chrome官网下载,广州网站推广自助,福州做网站的公司有哪些C 实现一个type list 模板#xff0c;在编译期计算。这个type list主要有构造#xff0c;列表头类型#xff0c;列表尾类型#xff0c;concat操作#xff0c;去除列表元素重复#xff0c;获取指定元素#xff0c;删除指定元素的操作。实现代码贴在下面#xff1a; #pr…C 实现一个type list 模板在编译期计算。这个type list主要有构造列表头类型列表尾类型concat操作去除列表元素重复获取指定元素删除指定元素的操作。实现代码贴在下面 #pragma once #include iostream #include typeinfonamespace type_list {// Step 1: 基础类型列表定义// 定义空列表template typename ...Typesstruct list {};// 非空列表的递归定义template typename Type, typename ...Typesstruct listType, Types... {using head Type;using tail listTypes...;};// 定义空列表类型using empty_list list;// Step 2: 获取列表头部类型template typename TypeListusing head_t typename TypeList::head;// 获取列表尾部类型template typename TypeListusing tail_t typename TypeList::tail;// 构造新列表template typename Head, typename Tailstruct construct;template typename Head, typename Tailusing construct_t typename constructHead, Tail::type;template typename Head, typename ...Typesstruct constructHead, listTypes... {using type listHead, Types...;};///templatetypename TypeListstruct size;// 模板辅助类templatetypename TypeListconstexpr size_t size_v sizeTypeList::value;//size的模板特化继承了std::integral_constanttemplatetypename...Typesstruct sizelistTypes... : std::integral_constantstd::size_t, sizeof...(Types) {};templateclass TypeListconstexpr bool empty_v (size_vTypeList 0);templateclass TypeListstruct empty : std::bool_constantempty_vTypeList {};templateclass TypeListconstexpr bool empty_s emptyTypeList::value;/// 查找模板的制定索引的value//声明一个模板;templatestd::size_t Index, class TypeListstruct get;templatestd::size_t Index, class TypeListusing get_t typename getIndex, TypeList::type;templatestd::size_t Index, class TypeListstruct get {using type get_tIndex - 1, tail_tTypeList;};templateclass TypeListstruct get0, TypeList {using type head_tTypeList;};/// concattemplatetypename TypeList1, typename TypeList2class concat;templatetypename T, typename Uusing concat_t typename concatT, U::type;templatetypename ...T, typename ...Uclass concatlistT..., listU... {public:using type listT..., U...;};// delete specific typetemplatetypename TypeList, typename Typeclass remove_all;templatetypename TypeList, typename Typeusing remove_all_t typename remove_allTypeList, Type::type;templatetypename TypeList, typename Typeclass remove_all {public:using head head_tTypeList;using tail tail_tTypeList;using clean_tail remove_all_ttail, Type;using type std::conditional_tstd::is_same_vhead, Type, clean_tail, construct_thead, clean_tail;};templatetypename Typeclass remove_allempty_list, Type {public:using type empty_list;};// get the last typetemplatetypename TypeListclass last;templatetypename TypeListusing last_t typename lastTypeList::type;templatetypename TypeListclass last {public:using type last_ttail_tTypeList;};// 递归终止templatetypename Typeclass lastlistType {public:using type Type;};// distinct list typetemplatetypename TypeListclass distinct;templatetypename TypeListusing distinct_t typename distinctTypeList::type;template typename TypeListclass distinct{public:using type construct_thead_tTypeList,distinct_tremove_all_ttail_tTypeList, head_tTypeList;};// 递归终止template struct distinctempty_list {using type empty_list;};// print listtemplatetypename Tvoid print_type() {int status;std::cout typeid(T).name() std::endl;}// 打印类型列表template typename TypeListstruct print_list;template typename TypeListvoid print_list_func() {print_listTypeList::print();}// 主模板递归地打印类型列表template typename TypeListstruct print_list {static void print() {print_typehead_tTypeList();print_list_functail_tTypeList();}};// 终止递归的特化版本template struct print_listempty_list {static void print() {// 空列表不打印任何内容}};} // namespace type_list测试代码 #pragma once#include type_list.h #include iostreamusing namespace std;void test_type_list() {//1.define listusing MyList type_list::listint, double, char;using AnotherList type_list::listfloat, int;using EmptyList type_list::list;//2. get the head and tail type of listusing MyListHead type_list::head_tMyList;using MyListTail type_list::tail_tMyList;static_assert(std::is_same_vMyList::tail, type_list::listdouble,char, MyList head shoud be int);static_assert(std::is_same_vMyListTail, type_list::listdouble, char, MyList head shoud be int);static_assert(std::is_same_vMyListHead, int, MyList head shoud be int);static_assert(std::is_same_vMyList::head, int, MyList head shoud be int);//3. get list sizeconstexpr std::size_t listSize type_list::size_vMyList;std::cout listSize std::endl;// 4. emptystatic_assert(type_list::empty_sEmptyList, is empty);static_assert(type_list::empty_vEmptyList, is empty);// 5. get index posusing FirstType type_list::get_t1, MyList;static_assert(std::is_same_vFirstType, double, not equal);// 6.concat listusing ConcatList type_list::concat_tMyList, AnotherList;using ConcatListHead type_list::head_tConcatList;static_assert(std::is_same_vConcatListHead, int, head should be int);static_assert(std::is_same_vConcatList::head, int, head should be int);constexpr std::size_t concat_list_size type_list::size_vConcatList;cout concat_list_size : concat_list_size endl;// 6.delete list typeusing RemoveIntList type_list::remove_allMyList, int;static_assert(std::is_same_vtype_list::head_tRemoveIntList, int, the list head shoud not be int);// 6.delete list typeusing LastType type_list::last_tMyList;static_assert(std::is_same_vLastType, char, the last type should be char);// distinct list typeusing RepeatList type_list::listint, double, char, int, double, char, int,int,int;using DistType type_list::distinct_tRepeatList;std::cout -------------------------- endl;type_list::print_list_funcRepeatList();std::cout -------------------------- endl;type_list::print_list_funcDistType();std::cout -------------------------- endl;}
http://www.hkea.cn/news/14504862/

相关文章:

  • asp.net 怎样生成网站一级建造师专业对照表
  • 花钱做的网站本人可以关闭吗厦门市建设局网站摇号
  • 亿玛酷网站建设wordpress阅读主题
  • 上海健康证查询网址搜索引擎优化怎么做的
  • 学ui可以做网站么网站功能建设与栏目划分
  • 西安公司网站建设域名抢注网站是怎么
  • 做网站用什么代码搭建网站费用
  • 电商网站建设前的市场分析内容wordpress文件执行顺序
  • 网站后台上传图片 不可用iframe网站后台模板
  • 给企业建设网站的意义wordpress 登录后页面空白页
  • 电子商务网站建设的步骤一般为(公路建设查询网站
  • 网站备案状态查询wordpress乱码
  • 团队协同网站开发云虚拟主机和网站建设
  • 网站建设打造百度自媒体怎么注册
  • 网站总体设计方案深圳优化网站公司
  • 兰州启点网站建设做相册的网站dw
  • 湛江网站网站建设上海外贸公司27号
  • 公司网站开源源码网站建设续费是什么费用
  • 淘宝网站c 设计怎么做的码支付wordpress前端
  • 义乌网站建设费用多少php网站开发设计论文
  • 新安网站建设潍坊外贸网站优化
  • 湖北智能网站建设找哪家美丽乡村 网站建设
  • 哪个公司的网站制作asp做网站的步骤
  • 网站模板建设报价深圳画册设计推荐
  • 做耳标网站faq插件 wordpress
  • 网站设计开发新乡网站建设加盟电话
  • 如何建立一个学校网站网站建设优化广告流量
  • 网站免费源码大全不用下载新网站如何做百度关键词
  • 网站建设公告jsp网站开发学习心得
  • 西安网站建立网站如何做网站名称