问题描述
我希望能够在运行时有效地构建数据结构。
这些数据结构需要在最短的时间内访问。
只有几种方法马上想到的将是
某种动态分配的数组:
(1)void指针,必须强制转换为所需的类型。
(2)所需指针的联合。
(3)继承层次结构
(4)可能是所需数据类型的并集。
我需要能够构建任意数据结构
,其速度与建立在
$ b $的速度相同b编译时,但我需要在运行时这样做。
有没有人有什么好主意???
I want to be able to efficiently build data structures at run-time.
These data structures need to be accessed with minimal time.
The only a few ways that come immediately to mind would be
some sort of dynamically allocated array of :
(1) void pointers, that must be cast into the desired types.
(2) union of the desired pointers.
(3) An Inheritance hierarchy
(4) Possibly a union of the desired data types.
I need to be able to construct arbitrary data structures
that have as close to the same speed as those build at
compiler-time, yet I need to do this at run-time.
Does anyone have any good ideas ???
推荐答案
取决于你真正想做的事情。
Mike
Depends on what you really want to do.
Mike
更准确地陈述你的问题。
Stephen Howe
State your problem more accurately.
Stephen Howe
它有助于了解您要做的事情,更大的图景。这是一个
语言运行时吗?
有多少动态结构在那儿?我一直在玩堆栈
用我的语言分配对象,所以我对你想要的东西感觉很好。
It helps to know what you are trying to do, the bigger picture. Is this a
language runtime?
How many "dynamic structures" are there? I''ve been playing with stack
allocated objects in my language so I kind of have a feeling of what you
want.
取决于你真正想做的事情。
迈克
Depends on what you really want to do.
Mike
这篇关于动态创建的结构???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!