Wednesday, March 23, 2011

Dictionary like implementation in C/C++ (Update info)

Does anyone have information or example of how to mount the equivalent of a Dictionary (VB6) in C or C++ ?
This implementation is used to be passed as a parameter called DLL VB6.

My intention is to create a Dictionary in C (win32 using VARIANT/ARRAYs, etc) and pass it to call a VB. So I have to learn how to create this data structure.

Tanks.

From stackoverflow
  • How about a map?

  • You mean besides std::map in the map header?

  • Dictionary is hash based, map is a tree based container. I think tr1 added a hash container of some sort but on a lot of platforms you can use hash_map

  • The next version of C++ will have unordered_map<> (apparently they thought that calling it hash_map would conflict with too many independent implementations), which will be a hash-based container.

    It was added to Boost, and is likely to be in TR1. As always, if your development system doesn't support the new standard features, I recommend Boost.

  • A hash table? You can find several existing hash table packages in C, for instance:

    You can also use a package made for permanent storage, since some have an option to keep everything in memory for speed.

    • HamsterDB "in memory database", option HAM_IN_MEMORY_DB
    • BerkeleyDB, may be by switching buffering off or specifying no file ("In-memory databases never intended to be preserved on disk may be created by setting the file parameter to NULL.")

0 comments:

Post a Comment