如何为不同基础类型、不同容量的相似数组结构体编写模板或泛型类型?
如何为不同基础类型、不同容量的相似数组结构体编写模板或泛型类型?
我最近写了几个结构体来存储小型数组,并且让它们支持按值复制,具体是这几个:
Array4 { base: int16|short, purpose: to store up to 4 values }Array8 { base: int32|int, purpose: to store up to 8 values }Array16 { base: int64|long, purpose: to store up to 16 values }
这些数组里的每个元素都占用4位空间。
下面是相关代码:
公共部分
using System; using System.Coll
内容来源于stack exchange
相关产品推荐
相关产品推荐

