|
| mogha (5) | |
| Is there is any container in STL which can accept three parameters. Like for e.g. container<int,int,int> all the three parameters are unique. | |
| kbw (1514) | |
| What are the 3 parameters you want to use? | |
| kempofighter (672) | |
| How do the three parameters relate to each other? Do you want a 3d array? What should the meaning of the three parameters be and how do you think that the container should work with those three template params? In other words, what are your requirements? | |
| mogha (5) | |
| My three parameters are strings, i need to search on the basis of any parameter into the container. Like if i have inserted a row like a,b,c as three parameters into the container then passing "a" as parameter i should be able to retrieve b and c and in the same way if i have b then i should able to search a and c and vice versa.i am looking for such kind of functionality so that my search operation must be fast My sample container look like a,b,c e,f,g and so on what is the best way to do this operation | |
| guestgulkan (1299) | |||
I suppose if your data comes in groups of 3 - then you could make a structure template:
and go from there... | |||
| kbw (1514) | |
| There isn't an STL container that'll do that directly. | |
Last edited on | |
| jsmith (3802) | |||
| But there is boost::multi_index_container, which will allow you log N lookups on all three fields. Be warned I have not tried to compile this; this is off the top of my head:
| |||
| kbw (1514) | |
| I'm impressed. | |
| mogha (5) | |
| Thanks for the replies, but i am not using Boost on my system(not included) as for the given framework it not there so i need to look for some different approach | |
| Abramus (81) | |
| EDIT: I'm stupid. This had no chance to work... | |
Last edited on | |
| jsmith (3802) | |
| I think OP is looking for something that would allow for log N lookups based on any of the three fields. Without boost, the only other thing I can come up with is three parallel data structures (std::sets<>) each sorted on different element. | |
This topic is archived - New replies not allowed.
