Does anyone know of a good C++ replacement fot the STL container classes?
I am specifically tired of dealing with std::map because of the awful
looking code it requires. This is some seriously ugly stuff:
<painful-code>
map<Class1,map<Class2,Class3> >::iterator iter = myMap.find( someInstance );
if( iter != myMap.end() ) {
map<Class2,Class3>::iterator subIter =
(*iter).second.find( someOtherInstance );
if( subIter != (*iter).second.end() ) {
...
}
}
</painful-code>
<mild-rant>
Why didn't the STL creators think to include an exists() method or a []
operator that didn't actually create an entry on use?! Sometimes even Java
looks good compared to the STL.
</mild-rant>
I'm trying to create some hierarchical structures that look more or less
like this in C++:
Class1
|
+---> Class2
| |
| +---> Class3
|
+---> Class2
| |
| +---> Class3
+ ...
If I were using some scripting language like Perl or PHP, this would be a
no-brainer, but since it's C++, I'm stuck with a brainer. Can anyone help
bail me out of this syntactical misery? Please no language flames, and
please only C++ answers.
Thanks in advance!
--Dave
.-----------------------------------.
| This has been a P.L.U.G. mailing. |
| Don't Fear the Penguin. |
| IRC: #utah at irc.freenode.net |
`-----------------------------------'