Thread: Assigning the content of one map to another map and doing the same with vector

  1. #46
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Programmer_P View Post
    Well, in this case, the problem was the "eofbit" was being set. Neither "badbit" or "failbit" were set, so I didn't see a need to output anything, or fail. I just cleared it and moved on. I guess I could do something like this though:
    Or you could just do
    Code:
    for (unsigned int i = 0; i < valuesOfEnumerators_v_i.size(); i++)
    {
        try
        {
            EnumValue = EmumVec.at(i);
            if (! (EnumStream << EnumValue)) throw std::exception("Unable to parse input.");
            if (! (EnumStream >> EnumStr)) throw std::exception("Unable to extract input.");
        }
        catch (const std::exception& e)
        {
            std::cout << e.what() << "\nBits: eof: " << EnumStream.eof() << " bad: " << EnumStream.bad() << " fail: " << EnumStream.fail() << std::endl;
        }
    }
    Simple, short, yet concise and gets the work done.

    The thing is, I didn't want to use my debugger. I wanted to waste my time putting out a lot of verbose, useless debug information, just so I could annoy you. And it worked...
    True, and you wasted lots of time yourself.

    I use it all the time. That's why you see lots of posts with "Last edited by Programmer_P;"...
    But apparently you favor multiple posts when finding something new to add instead of merging them into one post.

    I know there is a multi-quote button. But sometimes I forget about it. Anyway, I don't see what the big deal is. Why are you so into multi-quote buttons?
    Maybe you should work on finding if it exists? The problem is that you double and triple post. A lot.
    Such things are frowned upon. I guess it isn't long now until you're going to quadraple post.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #47
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Quote Originally Posted by whiteflags View Post
    It's not that something is wrong with the compiler or the streams you are using. In fact, pianorain's program is doing what it is supposed to do. I believe he is trying to point out your misuse, and your willingness to blame it on external factors, in a passive agressive way.
    The part in bold is really the most annoying part. I was continually reminded of 'How To Ask Questions The Smart Way'. Reading through that little guide is tremendously helpful.
    Quote Originally Posted by Elysia View Post
    You don't have a clear view of what the actual problem is, and that is by all definitions, bad. You must understand that streams are bastards in many ways.
    There is a super-saturation of truth in these statements. I expect crystalline formations to appear soon.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  3. #48
    Programming Ninja In-T...
    Join Date
    May 2009
    Posts
    827
    Quote Originally Posted by pianorain View Post
    The part in bold is really the most annoying part. I was continually reminded of 'How To Ask Questions The Smart Way'. Reading through that little guide is tremendously helpful.
    Hey, thanks for that link. The author of it definitely made some good points.
    I'll try to watch what I post a little better from now on...but seriously, its the Internet.
    Half of the time, I'm not even serious when I post stuff. Don't take it personal. Also don't think that I'm taking anything personal, because I'm not. Its just my personality to say things in a prickish way that always annoys people. That's more for amusement than anything else.
    And about the research/homework thing, I usually do do that before starting a thread (though I admit I maybe don't give it as much effort as I should). And right after discovering that the problem was with the stringstream, I read up on the stringstream << operator reference at cplusplus.com, but it didn't mention that it appended to existing data instead of replacing it. So I figured I would mention it here.
    Anyway, its funner to get feedback from real people on programming problems, rather than turning to Google all the time. Plus, getting involved in a discussion about the topic always helps me remember stuff better.
    I'm an alien from another world. Planet Earth is only my vacation home, and I'm not liking it.

Popular pages Recent additions subscribe to a feed