Hi all,
I want to use some container for this case:
i have 4 elements, say string1,string2,class1,class2.
I need string1,string2,class1 to be united, means if i access string1 in
this container you'll get class1. The problem is class2 is something flexible, sometimes it can be written, sometimes it can be deleted.
For example i had
{"Kanada","America","Weather","Rain")
when the main is run, the container will be something like this
{"Kanada","America",Weather","Sun").
which container should i use? or what container should i use?
i tried set(string,set(string,set(weather,condition))),
but it is really something hard to manipulate,
someone can help me?
thanks.

Can you give us a better use case or some sort of algorithm? It almost sounds like you want some sort of map, but your post is a little confusing...

here is mycode:
please don't worry about the syntax, i just want to know which container is the best to use, and thanks for remind me, it's map, not set
sorry,

class database
{
  public:
   void showdatabase();
   void updatedatabase(String&,String&,String&,String&);
   private:
   map(string,map(string,map(weather,condition)));
};

when user that had connection with america and kanada, wants to change the weather he simply type update("weather","rain"),
then the program will search in class above which has {"Kanada,"America","",""}, then replace with
{"Kanada","America","Weather","rain"},
is it really the best to use map in map?
thanks for your help, sorry if my questions is confusing

I don't see why it would be an issue, all you're doing is linking a key defined as one class to a value of another class. Why can't the value be another map?

I'm afraid I'm going to have to defer to other posters though.

hmm, yes i think you're right,
thanks for your advice

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.