...
首页> 外文期刊>C - C++ Users Journal >C++/CLI: Value Class Types
【24h】

C++/CLI: Value Class Types

机译:C ++ / CLI:值类类型

获取原文
获取原文并翻译 | 示例

摘要

Until now, all the class types I've used in this series have been ref classes, which means that instances of them-including those declared on the stack-are managed by the garbage collector. This month, I look at what is often referred to as a "lightweight" class mechanism; namely, the value class, instances of which are not managed by the garbage collector. Value class types are particularly useful for reasonably small data structures that have value semantics. Examples include points in a coordinate system and complex numbers. Typically, a good candidate for implementation as a value class will have only a few data members, will not require inheritance, and will not be expensive in terms of passing and returning by value or copying during assignment.
机译:到目前为止,我在本系列文章中使用的所有类类型都是ref类,这意味着它们的实例(包括在堆栈上声明的实例)由垃圾收集器管理。本月,我将介绍通常被称为“轻量级”的类机制。即,值类,其实例不由垃圾收集器管理。值类类型对于具有值语义的合理的小型数据结构特别有用。示例包括坐标系中的点和复数。通常,作为值类实现的良好候选者将只有几个数据成员,不需要继承,并且在按值传递和返回或在赋值期间进行复制方面不会昂贵。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号