Thread: Which map structure should I use?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    110

    Which map structure should I use?

    I'm going to map chunks of string to chars. There's going to be 256 <key - element> links. The map is going to be used like this.

    string str = "ABCDABCDABCD"; //A string that's going to be mapped.
    string copm_str ; .. .. .. .. .. ..// Mapped string, compressed.

    str [function that uses map to compress data] -> comp_str; ..//Sorry if I'm vague, I haven't looked at members of the map classes in C++.

    The map is going to look something like this.
    a = "AAAA";
    b = "AAAB";
    etc..
    t = "ABCD";
    etc..

    So in this example the string str would be mapped to, comp_str = "ttt". If I got this right I only need to find elements and keys in the map. So my question is, which C++ map should I use? (It's been a while since I tinkered in C++)

    Edit, I'm looking for the structure with the lowest complexity while finding elements or keys.
    Last edited by überfuzz; 11-24-2012 at 09:52 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to find number of structure members in a given structure?
    By bhaskarReddy in forum C Programming
    Replies: 4
    Last Post: 01-16-2012, 05:37 AM
  2. Replies: 4
    Last Post: 04-25-2010, 10:57 AM
  3. Replies: 1
    Last Post: 04-02-2009, 06:51 AM
  4. Replies: 9
    Last Post: 05-21-2007, 12:10 AM
  5. Replies: 4
    Last Post: 11-22-2006, 12:20 PM