Re: Need Container for Large Binary String

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: M Jared Finder (mfinder_at_digipen.edu)
Date: 11/14/04

  • Next message: Jorgen Grahn: "Re: Need Container for Large Binary String"
    Date: 14 Nov 2004 05:40:15 -0500
    
    

    floobles wrote:
    > Hi,
    >
    > I need to manipulate large binary strings. I would like to use some
    > typical array functions (such as find first occurrence,
    > insert/replace, etc.)
    >
    <snip>
    >
    > I would appreciate some suggestions on which class to use. At this
    > point, I'm most likely going with the STL vector, using a for-loop to
    > initialize my bytes...(ugh)

    Use the constructor of vector that takes a begin iterator and an end
    iterator. Pointers are iterators, so you can say
    vector<char> v(p, p+length) when given a pointer and a length.

        -- MJF

          [ See http://www.gotw.ca/resources/clcm.htm for info about ]
          [ comp.lang.c++.moderated. First time posters: Do this! ]


  • Next message: Jorgen Grahn: "Re: Need Container for Large Binary String"

    Relevant Pages

    • Re: Need Container for Large Binary String
      ... > point, I'm most likely going with the STL vector, using a for-loop to ... Use the constructor of vector that takes a begin iterator and an end ... Pointers are iterators, so you can say ...
      (microsoft.public.vc.mfc)
    • Re: vector, 1) .insert(..) 2) .erase(oldpos)
      ... Adding to a vector can mean reallocating new memory (of existing size + ... just pointers. ... An iterator can therefore be ...
      (comp.lang.cpp)
    • Re: Standard containers (Was: Wiki by the committee closed?)
      ... Since a fixed size is certainly enough for an iterator, ... bad pointers, overflows, and maybe even CONTAINER_ERROR_INDEX), why not ... be reported if a container is accessed out of bounds. ... OUR list elements never change when you add something to our lists. ...
      (comp.std.c)
    • Re: abstract containers: does such a thing exist, conceptually?
      ... create a firewall between different types of lists. ... > behaviour by the additional pointers. ... I do not like much STL's style of iteration with iterator objects, ... For example, an array view for containers with ordered elements, ...
      (comp.object)
    • Re: Pointer To A Vector Elements While Still Adding
      ... however there are cases that pointers get invalidated too in deque case. ... "surface" encapsulation about the type of the target container used, ... "surface" encapsulation can be provided by a typedef of the iterator type used. ...
      (comp.lang.cpp)