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组件摘要:):
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
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有