网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

C++怎么为概念定义公理

这篇文章主要介绍“C++怎么为概念定义公理”,在日常操作中,相信很多人在C++怎么为概念定义公理问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”C++怎么为概念定义公理”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

创新互联服务项目包括凤翔网站建设、凤翔网站制作、凤翔网页制作以及凤翔网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,凤翔网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到凤翔省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

T.22:为概念定义公理

Reason(原因)

A meaningful/useful concept has a semantic meaning. Expressing these semantics in an informal, semi-formal, or formal way makes the concept comprehensible to readers and the effort to express it can catch conceptual errors. Specifying semantics is a powerful design tool.

有意义/有用的概念会包含语义上的含义。以非正规的,半正规的或者正规的方式进行表现这些语义可以让概念更容易被用户理解,而且表达概念的努力可以捕捉概念方面的错误。定义语义是一种有力的设计工具。

Example (using TS concepts)(示例(适用TS概念))

template
   // The operators +, -, *, and / for a number are assumed to follow the usual mathematical rules
   // axiom(T a, T b) { a + b == b + a; a - a == 0; a * (b + c) == a * b + a * c; /*...*/ }
   concept Number = requires(T a, T b) {
       {a + b} -> T;   // the result of a + b is convertible to T
       {a - b} -> T;
       {a * b} -> T;
       {a / b} -> T;
   }
Note(注意)

This is an axiom in the mathematical sense: something that may be assumed without proof. In general, axioms are not provable, and when they are the proof is often beyond the capability of a compiler. An axiom may not be general, but the template writer may assume that it holds for all inputs actually used (similar to a precondition).

这是一条有关数学规律的公理:某些不需要证据的假设。通常,公理是不可证明的,即使它们可以证明,通常也会超越编译器的能力。公理可能并不普遍,但是模板作者可以假设它对所有实际使用的输入有效(类似前提条件)

Note(注意)

In this context axioms are Boolean expressions. See the Palo Alto TR for examples. Currently, C++ does not support axioms (even the ISO Concepts TS), so we have to make do with comments for a longish while. Once language support is available, the // in front of the axiom can be removed

在这个上下文中公理是一个布尔类型的表达式。参见Palo Alto TR中的例子。目前C++还没有支持公理(包括ISO Concepts TS),因此我们必须在很长一段时间将它放在注释内。一旦语言提供了对公理的支持,就可以去掉前面的//。

Note(注意)

The GSL concepts have well-defined semantics; see the Palo Alto TR and the Ranges TS.

GSL概念提供了定义良好的语义。参见Palo Alto TR和范围TS。

Exception (using TS concepts)(例外(使用TS概念))

Early versions of a new "concept" still under development will often just define simple sets of constraints without a well-specified semantics. Finding good semantics can take effort and time. An incomplete set of constraints can still be very useful:

仍在开发中的新“概念”的早期版本通常只是定义某些约束的简单集合,而这些约束可能并不具有良好定义的语义。发现完美的语义需要努力和时间。约束的不完全集合同样可以非常有用。

// balancer for a generic binary tree
template concept bool Balancer = requires(Node* p) {
   add_fixup(p);
   touch(p);
   detach(p);
}

So a Balancer must supply at least thee operations on a tree Node, but we are not yet ready to specify detailed semantics because a new kind of balanced tree might require more operations and the precise general semantics for all nodes is hard to pin down in the early stages of design.

因此树节点上的Balancer必须至少支持三个操作,但是我们还没有准备好定义语义的细节,因为新种类的平衡树可能需要更多的操作,而且适用于所有节点的准确、通用的语义很难在设计的早期阶段确定。

A "concept" that is incomplete or without a well-specified semantics can still be useful. For example, it allows for some checking during initial experimentation. However, it should not be assumed to be stable. Each new use case may require such an incomplete concept to be improved.

不完全或者没有良好定义的“概念”仍然有用。例如,它允许在初始化阶段进行某些检查。然而,它不应该被认定是稳定的。每一次新用法都可能让这个不完全的概念发生改变。

Enforcement(实施建议)

  • Look for the word "axiom" in concept definition comments

  • 在概念定义的注释中发现”axiom“。

到此,关于“C++怎么为概念定义公理”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!


分享题目:C++怎么为概念定义公理
URL分享:http://bjjierui.cn/article/ijdjch.html

其他资讯