前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >C++核心准则​GSL:指南支持库

C++核心准则​GSL:指南支持库

作者头像
面向对象思考
发布2020-11-17 11:55:40
8620
发布2020-11-17 11:55:40
举报

GSL: Guidelines support library

GSL:指南支持库

The GSL is a small library of facilities designed to support this set of guidelines. Without these facilities, the guidelines would have to be far more restrictive on language details.

GSL是旨在支持这套准则的小型功能库。如果没有这些功能,本指南将不得不对语言细节进行更多的限制。

The Core Guidelines support library is defined in namespace gsl and the names might be aliases for standard library or other well-known library names. Using the (compile-time) indirection through the gsl namespace allows for experimentation and for local variants of the support facilities.

核心准则支持库在名称空间gsl中定义,并且名称可能是标准库或其他知名库名称的别名。通过gsl命名空间使用(编译时)间接方式可以进行试验,并可以使用所支持功能的本地变体。

The GSL is header only, and can be found at GSL: Guidelines support library. The support library facilities are designed to be extremely lightweight (zero-overhead) so that they impose no overhead compared to using conventional alternatives. Where desirable, they can be "instrumented" with additional functionality (e.g., checks) for tasks such as debugging.

GSL只包含头文件,可以在GSL:准则支持库中(https://github.com/Microsoft/GSL)找到。支持库的功能设计非常轻巧(零开销),因此与使用常规替代方法相比,它们没有任何开销。如果需要,可以将它们与其他功能(例如检查)“结合在一起”,以进行调试等任务。

These Guidelines use types from the standard (e.g., C++17) in addition to ones from the GSL. For example, we assume a variant type, but this is not currently in GSL. Eventually, use the one voted into C++17.

除了来自GSL的类型外,这些准则还使用标准(例如C ++ 17)中的类型。例如,我们假设一个变体类型,但这在GSL中当前不存在。最终,使用投票决定加入C ++ 17的那个。

Some of the GSL types listed below might not be supported in the library you use due to technical reasons such as limitations in the current versions of C++. Therefore, please consult your GSL documentation to find out more.

由于技术原因(例如当前C ++版本的限制),您使用的库中可能不支持下面列出的某些GSL类型。因此,请查阅您的GSL文档以了解更多信息。

Summary of GSL components(GSL组件摘要:):

  • GSL.view: Views GSL.view:视图
  • GSL.owner GSL所有者
  • GSL.assert: Assertions GSL.assert:断言
  • GSL.util: Utilities GSL.util:实用程序
  • GSL.concept: Concepts GSL.concept:概念

We plan for a "ISO C++ standard style" semi-formal specification of the GSL.

我们计划制定GSL的“ ISO C ++标准样式”半正式规范。

We rely on the ISO C++ Standard Library and hope for parts of the GSL to be absorbed into the standard library.

我们依靠ISO C ++标准库,希望将GSL的某些部分吸收到标准库中。

原文链接

https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#gsl-guidelines-support-library

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2020-11-11,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 面向对象思考 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • GSL: Guidelines support library
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档