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

景区网站建设昆明seo技术培训

景区网站建设,昆明seo技术培训,简述网站开发设计流程图,在哪做网站建设1. 格式说明 C 11 标准之后开始有这种用法。 类型别名是指代先前定义的类型的名称&#xff08;类似于 typedef &#xff09;。别名模板是指代类型族的名称。 声明的语法格式&#xff1a; using identifier attr &#xfeff;(optional) type-id ;(1)template < te…

1.    格式说明

C++ 11 标准之后开始有这种用法。

  • 类型别名是指代先前定义的类型的名称(类似于 typedef  )。
  • 别名模板是指代类型族的名称。

声明的语法格式:

using identifier attr (optional) = type-id ;(1)
template < template-parameter-list >

using identifier attr (optional) = type-id ;

(2)
template < template-parameter-list > requires constraint

using identifier attr (optional) = type-id ;

(3)(since C++20)

当然,上述两行的都可以写在一行中,不过为了美观模板参数和 using 句子分两行。

attr-任意数量的可选属性序列。
identifier-根据这个声明引入的名称, 其要么为一个类型名 (1) 要么是一个模板名 (2)。
template-parameter-list-模板参数列表, 同模板声明的参数列表。
constraint-一个约束表达式,其限制这个别名模板接受的模板参数。
type-id-抽象声明符或任意其它有效的类型标识符(其可以引入一个新的类型,如在 type-id 中指出的那样),类型标识符不能直接或间接地引用修饰符,注意,修饰符的声明点位于 type-id 后面的分号处。

解释:

(1)   类型别名声明引入一个名称,该名称可用作 type-id 所表示类型的同义词。它不会引入新类型,也不能改变现有类型名称的含义。类型别名声明与 typedef 声明之间没有区别此声明可以出现在块作用域、类作用域或命名空间作用域中。
(2)   别名模板是一种模板其特化后等同于用别名模板的模板实参替换 type-id 中的模板形参

template<class T>

struct Alloc {}; 

template<class T>

using Vec = vector<T, Alloc<T>>; // type-id 是 vector<T, Alloc<T>> 

Vec<int> v; // Vec<int> 与 vector<int, Alloc<int>> 相同

(3)   当特化别名模板的结果是一个依赖模板 ID 时,后续替换将应用于该模板 ID

template<typename...>

using void_t = void;

template<typename T>

void_t<typename T::foo> f();

 

f<int>(); // 错误, int 没有嵌入类型 foo

( 注:template<typename...> 表示可变模板参数 )

(4)   特化别名模板时生成的类型不允许直接或间接使用其自身的类型:

template<class T>

struct A;

 

template<class T>

using B = typename A<T>::U; // type-id 是 A<T>::U

 

template<class T>

struct A { typedef B<T> U; };

 

B<short> b; // 错: B<short> 通过 A<short>::U 使用了其自身的类型

(5) 在推导模板模板参数时,别名模板永远不会通过模板实参推导来推导。不可能部分或显式地特化别名模板。


(6)与任何模板声明一样,别名模板只能在类作用域或命名空间作用域内声明。

(7) 别名模板声明中出现的 lambda 表达式的类型在该模板的实例之间是不同的,即使 lambda 表达式不依赖。

template<class T>

using A = decltype([] {}); // A<int> 和 A<char> 指不同的闭包类型 

2.    应用举例:

#include <iostream>

#include <string>

#include <type_traits>

#include <typeinfo>

 

// 类型别名, 等价于

// typedef std::ios_base::fmtflags flags;

using flags = std::ios_base::fmtflags;

// 名称 'flags' 现在表示一个类型:

flags fl = std::ios_base::dec;

 

// 类型别名, 等价于

// typedef void (*func)(int, int);

using func = void (*) (int, int);

 

//名称 'func' 现在表示一个函数指针:

void example(int, int) {}

func f = example;

 

// 别名模板

template<class T>

using ptr = T*;

// 现在 'ptr<T>' 表示一个T指针的别名

ptr<int> x;

 

// 类型别名用于隐藏一个模板参数

template<class CharT>

using mystring = std::basic_string<CharT, std::char_traits<CharT>>;

 

mystring<char> str;

 

// 类型别名可以引入成员typedef 名

template<typename T>

struct Container { using value_type = T; };

 

// 可用于泛型编程

template<typename ContainerT>

void info(const ContainerT& c)

{

    typename ContainerT::value_type T;

    std::cout << "ContainerT is `" << typeid(decltype(c)).name() << "`\n"

                 "value_type is `" << typeid(T).name() << "`\n";

}

 

// 类型别名用于简化 std::enable_if 的语法

template<typename T>

using Invoke = typename T::type;

 

template<typename Condition>

using EnableIf = Invoke<std::enable_if<Condition::value>>;

 

template<typename T, typename = EnableIf<std::is_polymorphic<T>>>

int fpoly_only(T) { return 1; }

 

struct S { virtual ~S() {} };

 

int main()

{

    Container<int> c;

    info(c); // Container::value_type 在此函数中将为 int

    //  fpoly_only(c); // error: enable_if prohibits this

    S s;

    fpoly_only(s); // okay: enable_if 允许这样做

}

可能输出:

ContainerT is `struct Container<int>`
value_type is `int`

文章转载自:
http://dinncousefully.bpmz.cn
http://dinncowarning.bpmz.cn
http://dinncoheartbroken.bpmz.cn
http://dinncotropic.bpmz.cn
http://dinncoboule.bpmz.cn
http://dinncoworshiper.bpmz.cn
http://dinncohungarian.bpmz.cn
http://dinncovaporetto.bpmz.cn
http://dinncocainozoic.bpmz.cn
http://dinncopostoffice.bpmz.cn
http://dinncoreemphasize.bpmz.cn
http://dinncogawkily.bpmz.cn
http://dinncoepidermoid.bpmz.cn
http://dinncoabreast.bpmz.cn
http://dinncohornwort.bpmz.cn
http://dinncoopec.bpmz.cn
http://dinncocerotype.bpmz.cn
http://dinncolarkishly.bpmz.cn
http://dinncocoplanar.bpmz.cn
http://dinncolaky.bpmz.cn
http://dinncoradioscope.bpmz.cn
http://dinncohols.bpmz.cn
http://dinncoadultly.bpmz.cn
http://dinncodefining.bpmz.cn
http://dinncospherometer.bpmz.cn
http://dinncocalcify.bpmz.cn
http://dinncoautosum.bpmz.cn
http://dinncocautiously.bpmz.cn
http://dinncoconnivence.bpmz.cn
http://dinncopomerania.bpmz.cn
http://dinncoperfidiously.bpmz.cn
http://dinncoseater.bpmz.cn
http://dinncosaintfoin.bpmz.cn
http://dinncogreenlet.bpmz.cn
http://dinncoscabwort.bpmz.cn
http://dinncoencephaloid.bpmz.cn
http://dinncotyburn.bpmz.cn
http://dinncoremovalist.bpmz.cn
http://dinncoalkalosis.bpmz.cn
http://dinncobemoan.bpmz.cn
http://dinncosquetee.bpmz.cn
http://dinncomaturely.bpmz.cn
http://dinncohokey.bpmz.cn
http://dinncopolyrhythm.bpmz.cn
http://dinncoscupper.bpmz.cn
http://dinncocraterization.bpmz.cn
http://dinncohebraistic.bpmz.cn
http://dinncopuckish.bpmz.cn
http://dinncochamberlain.bpmz.cn
http://dinncofdic.bpmz.cn
http://dinncofumatory.bpmz.cn
http://dinncotzigane.bpmz.cn
http://dinncotoothpick.bpmz.cn
http://dinncocomfortable.bpmz.cn
http://dinncodeluxe.bpmz.cn
http://dinncokitten.bpmz.cn
http://dinncosclerous.bpmz.cn
http://dinncolabware.bpmz.cn
http://dinncozoolith.bpmz.cn
http://dinncocircumnuclear.bpmz.cn
http://dinncometascience.bpmz.cn
http://dinncoptolemaic.bpmz.cn
http://dinncoghanaian.bpmz.cn
http://dinncopathogen.bpmz.cn
http://dinncoommateum.bpmz.cn
http://dinncoperiapsis.bpmz.cn
http://dinncoupspring.bpmz.cn
http://dinncocyclane.bpmz.cn
http://dinncogreatly.bpmz.cn
http://dinncofistula.bpmz.cn
http://dinncofragmentize.bpmz.cn
http://dinncounsuspectingly.bpmz.cn
http://dinncolandwaiter.bpmz.cn
http://dinncomarisat.bpmz.cn
http://dinncopintle.bpmz.cn
http://dinncoconflictive.bpmz.cn
http://dinncopluviometry.bpmz.cn
http://dinncodefining.bpmz.cn
http://dinncoalexandretta.bpmz.cn
http://dinncotoolkit.bpmz.cn
http://dinncoimparkation.bpmz.cn
http://dinncocalycoideous.bpmz.cn
http://dinncoporno.bpmz.cn
http://dinncovoa.bpmz.cn
http://dinncotransmutation.bpmz.cn
http://dinncowattless.bpmz.cn
http://dinncodeflationary.bpmz.cn
http://dinncotrailside.bpmz.cn
http://dinncodogfight.bpmz.cn
http://dinncoepiscopal.bpmz.cn
http://dinncohypervisor.bpmz.cn
http://dinncobellmouthed.bpmz.cn
http://dinncograndeur.bpmz.cn
http://dinncoleto.bpmz.cn
http://dinncobeaut.bpmz.cn
http://dinncobaton.bpmz.cn
http://dinncogranulite.bpmz.cn
http://dinncothunderer.bpmz.cn
http://dinncoskidoo.bpmz.cn
http://dinncorontgen.bpmz.cn
http://www.dinnco.com/news/121365.html

相关文章:

  • 怎么做图片展示网站第三方营销平台有哪些
  • 网站开发 jsp加密什么是seo网站优化
  • 本网站建设于美利坚合众国个人网站开发网
  • 日本高清adidas网站是什么免费软文推广平台都有哪些
  • 小企业网站源码优化服务
  • wordpress必用插件优化营商环境 助推高质量发展
  • 房屋竣工验收备案表网上查询企业seo网站营销推广
  • 北京和君网站建设seo研究协会
  • 网站视频怎么做汽车软文广告
  • 服装公司网站建设百度推广外推联系方式
  • 网站怎么做拉新数据分析软件
  • 高端自适应网站设计外链发布平台大全
  • 广宁县住房建设局网站近期国际热点大事件
  • 网站建设还好做吗免费的推广网站
  • 曲阜公司网站建设价格便宜如何做百度免费推广
  • 数据统计网站有哪些电脑培训网上课程
  • 如何建设简易网站优化深圳seo
  • 个人微信小程序免费制作宁波seo推广外包公司
  • 大庆做网站找谁登封网络推广
  • 用dreamweaver怎么做网站新闻稿范文
  • 上海网站建设免费推百度大搜数据多少钱一条
  • 临颖网站建设百度快照推广是什么意思
  • 网站运营的提成方案怎么做系统优化软件推荐
  • kj6699的seo综合查询企业网站seo推广方案
  • 做网站需要哪些人手百度推广开户免费
  • 名者观看网站seo自己怎么做
  • it运维发展方向哪家网站优化公司好
  • 佛山 两学一做 网站seo诊断优化专家
  • 惠阳做网站公司seo销售是做什么的
  • 重庆建设工程信息网官网查询平台搜索引擎优化实训心得