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

面向对象思考

共 2768字,需浏览 6分钟

 ·

2020-11-13 10:39

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


新书介绍

《实战Python设计模式》是作者最近出版的新书,拜托多多关注!

本书利用Python 的标准GUI 工具包tkinter,通过可执行的示例对23 个设计模式逐个进行说明。这样一方面可以使读者了解真实的软件开发工作中每个设计模式的运用场景和想要解决的问题;另一方面通过对这些问题的解决过程进行说明,让读者明白在编写代码时如何判断使用设计模式的利弊,并合理运用设计模式。

对设计模式感兴趣而且希望随学随用的读者通过本书可以快速跨越从理解到运用的门槛;希望学习Python GUI 编程的读者可以将本书中的示例作为设计和开发的参考;使用Python 语言进行图像分析、数据处理工作的读者可以直接以本书中的示例为基础,迅速构建自己的系统架构。




觉得本文有帮助?请分享给更多人。

关注微信公众号【面向对象思考】轻松学习每一天!

面向对象开发,面向对象思考!



浏览 12
点赞
评论
收藏
分享

手机扫一扫分享

举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

举报