OK, then, when you translate it to C++, make your life simpler and use STL. Then you'll find that your hashes, vectors and foreach loops translate fairly easily:
Also, what I've shown isn't great STL. There are functors and predicates that let you do things like map and grep. Give it a try. You'll find that it makes C++ much nicer. (Though it does take a bit of time to wrap your head around it when you start.)vector<X> aas; vector<X>::iterator aa; map<K,V> SEQ; map<K,V>::iterator seq; vector<Z> codons; vector<Z>::iterator codon; for (aa=aas.begin(); aa!=aas.end(); ++aa) { for (seq=SEQ.begin(); seq!=SEQ.end(); ++seq) { for (codon=codons.begin(); codon!=codons.end(); ++codon) { ... do something ... } } }
--roboticus
In reply to Re^5: foreach to for (related to my last question)
by roboticus
in thread foreach to for (related to my last question)
by tricolaire
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |