Thread: Easy way to ignore chars?

  1. #16
    myNegReal
    Join Date
    Jun 2005
    Posts
    100
    Wow this is greate information, helping a lot, I'm finding places where I can optimize using strings now, though still some are char*s. I prefer using a char* except when I gotta do a lot of manipulation on the string. That's where I'm converting it. Makes it much easier.
    Using Dev-C++ on Windows

  2. #17
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Not to advocate premature optimization here, but if you are doing a lot of conversion between the two forms, it'd probably be beneficial to stick to one (where possible). And, while a number of operations built into std::string are harder to accomplish with char*s, note that in a lot of cases, you can use STL algorithms on arrays (such as char*s), using the appropriate pointers to array elements as the iterators.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  3. #18
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> if you're going to stick with char*...
    vector<char>

    >> ...which really ought to be limited to libraries and such that already have the dependency on C-style strings
    Agreed!

    >> but nothing really uses strings, so I just keep it char*s
    >> [Problem is,] assigning [c_str()] to a non-const char*, which most of mine are.
    Stop using char*'s then most won't be

    If you find yourself using C-functions like strstr() or strchr() - ask yourself, "WWSD"?

    If you don't know the C++ equivalent, or you think that the C equivalent is more efficient - post your scenario on this forum so others can have a crack at it.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Easy String position question...
    By Striph in forum C Programming
    Replies: 4
    Last Post: 05-11-2009, 08:48 PM
  2. question about ignore()????
    By newbie02 in forum C++ Programming
    Replies: 4
    Last Post: 08-11-2003, 08:27 AM
  3. EASY GUI development.. like with Qt?
    By rezonax in forum C++ Programming
    Replies: 2
    Last Post: 09-16-2001, 01:18 PM