|
|
Orchid XP v8 <voi### [at] devnull> wrote:
> OK, any C++ experts have any idea why this code snippet causes my
> program to crash at runtime?
> typedef std::vector<bool> Codeword;
> std::string codeword(const Codeword &c)
> {
> std::string out;
> for (unsigned int i=0; i<c.size(); i++)
> if (c[i]) out.append("1"); else out.append("0");
> return out;
> }
I can't see anything wrong with it, and I tried it and there was
nothing wrong with it. The error must be somewhere else.
If you are running it in linux, try running it using valgrind (if you
don't have it, install it; it's essential). In other words:
valgrind ./yourprogram
If will tell you if you have some out-of-bounds access or memory leaks.
--
- Warp
Post a reply to this message
|
|