草庐IT

intStrMap

全部标签

c++ - 将 std::map 移植到 C?

我正在将一些c++代码移植到c。什么是c中std::map的可行等价物?我知道c中没有等价物。这是我正在考虑使用的:在C++中:std::mapm_Textures;在c中:typedefstruct{uint*intKey;sTexture*textureValue;}sTMTextureMap;这是可行的还是我过于简化了map?以防万一您没有得到纹理贴图的目的。 最佳答案 许多C实现支持tsearch(3)或hsearch(3)。tsearch(3)是一棵二叉树,您可以提供一个比较器回调。我认为这与您接近std::map的距离差

c++ - 将 std::map 移植到 C?

我正在将一些c++代码移植到c。什么是c中std::map的可行等价物?我知道c中没有等价物。这是我正在考虑使用的:在C++中:std::mapm_Textures;在c中:typedefstruct{uint*intKey;sTexture*textureValue;}sTMTextureMap;这是可行的还是我过于简化了map?以防万一您没有得到纹理贴图的目的。 最佳答案 许多C实现支持tsearch(3)或hsearch(3)。tsearch(3)是一棵二叉树,您可以提供一个比较器回调。我认为这与您接近std::map的距离差