这段英文是什么意思7

来源:百度知道 编辑:UC知道 时间:2024/06/18 08:08:16
1.8 Another Implementation — ‘‘Bag’’ 7
___________________________________________________________________________

int differ (const void * a, const void * b)
{
return a != b;
}

Objects differ exactly when the array indices representing them differ, i.e., a simple
pointer comparison is sufficient.

We are done — for this solution we have not used the descriptors Set and
Object but we have to define them to keep our C compiler happy:

const void * Set;
const void * Object;

We did use these pointers in main() to create new sets and objects.

1.8 Another Implementation — Bag

Without changing the visible interface in Set.h we can change the implementation.
This time we use dynamic memory and represent sets and objects as structures:

18又实施——“包”
┅_____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____

智力不等(常量空了、空* * b)。
{
返回一个! = b。
}

元素对象不同也就是他们在数组中对应的序号不同,也就是说,一个简单的
指针比较来说已经足够了。

我们正在做-解决这个问题,我们没有使用描述符和
但我们必须确定对象来保持我们的C编译器的快乐。

恒无效;*
恒无效*对象。

我们使用这些链接在创造新设置和对象。

18又实施-袋

不可见的界面,我们可以改变Set.h实施。
这次我们使用动态记忆和代表和物体的结构。

集合{符号计算;>)。
{ > >符号计算,物体的设置*,。

计数追踪的元素在一套。为一个元素,计数
有多少次这个记录的元素被添加到设置。如果我们递减
计算每次元素是通过下降(),只有移除元素
一旦计数为0,我们有一个袋子,即把元素有一个参考
计数。

既然我们将会使用动态内存来代表和目标,我们需要
初始化对象的描述,使新()可以找到多少
记忆保留。

静态协议的作用是常量大小长度)>)。
静态常量大小_ t对象长度>刊于《对象)=。

设置失效* =和色彩的作用。
恒空性客体对象= &。

新的()现在是简单得多。

无效的* *型新(常量无效,…)
{常量尺寸大小= *(t��t)常量大小型,
无效的* p = calloc(1,