J
Jeffrey Walton
Hi All,
I have a need for a 'binary string'. I'm going to side step the size
of a byte and just assume it is 8 bits (in reality, all the platforms
I support use octets - no PDP-10s on the hardware list). So a byte
would be either unsigned char or uint8_t.
I noticed that neither msvc [1] nor stdc++/libg++ [2] appear to
provide a specialization for a vector<byte> (poking and proding with
WinDbg and gdb). Does anyone have pointers to some existing code?
I'm interested in some basic_string operations (such as concatenation
and substr); but I'm not interested in others (such as find).
Conceptually, I don't think basic_string<byte> is appropriate. Plus,
there's a tax to be paid due to facets, locales, and traits.
I also can't see using a stock vector<byte> when taking into
consideration (1) there are no endian issues, (2) there are no
alignment issues (3) vectors have been unambiguously contiguous since
TR1 (4) c functions, such as memcpy and memset, can be orders of
magnitude faster than the discrete c++ counter parts (such as
std::copy(...) and friends).
On the wish list: I would also like a O(1) delete from the beginning
of the binary string. I suspect a lazy delete coupled with a 'leading
offset' will do the trick.
Finally, I'm not interested in bringing another dependency, so
libraries such as boost need not apply (http://www.boost.org/doc/
libs/).
Jeff
[1] C Run-Time Libraries ,
http://msdn.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx
[2] Standard C++ Library, http://gcc.gnu.org/libstdc++/
I have a need for a 'binary string'. I'm going to side step the size
of a byte and just assume it is 8 bits (in reality, all the platforms
I support use octets - no PDP-10s on the hardware list). So a byte
would be either unsigned char or uint8_t.
I noticed that neither msvc [1] nor stdc++/libg++ [2] appear to
provide a specialization for a vector<byte> (poking and proding with
WinDbg and gdb). Does anyone have pointers to some existing code?
I'm interested in some basic_string operations (such as concatenation
and substr); but I'm not interested in others (such as find).
Conceptually, I don't think basic_string<byte> is appropriate. Plus,
there's a tax to be paid due to facets, locales, and traits.
I also can't see using a stock vector<byte> when taking into
consideration (1) there are no endian issues, (2) there are no
alignment issues (3) vectors have been unambiguously contiguous since
TR1 (4) c functions, such as memcpy and memset, can be orders of
magnitude faster than the discrete c++ counter parts (such as
std::copy(...) and friends).
On the wish list: I would also like a O(1) delete from the beginning
of the binary string. I suspect a lazy delete coupled with a 'leading
offset' will do the trick.
Finally, I'm not interested in bringing another dependency, so
libraries such as boost need not apply (http://www.boost.org/doc/
libs/).
Jeff
[1] C Run-Time Libraries ,
http://msdn.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx
[2] Standard C++ Library, http://gcc.gnu.org/libstdc++/