Question: While `string` should be used for working with strings, I would like to know what structure you should use in C++ when working with blocks of data.

I'm asking this because it would be nicer to use one parameter instead of passing a `char* data` and `size_t size` (or a custom structure).

Answer: 
```
std::vector<unsigned char>

```

or, preferably,

```
std::vector<std::uint8_t>

```

(In C++11, `uint8_t` can be found in `<cinttypes>`. Older compilers, but not MSVC, may have the C99 header `<inttypes.h>`. If your data is a sequence of 16-bit units, use `uint16_t` etc.)

If the size of the data blocks is known at compile time, [`std::array`](http://en.cppreference.com/w/cpp/container/array) is appropriate; it wastes less space than `vector`.
The above solutions is good, but consider this solution may be good :

1. [bitset](http://www.cplusplus.com/reference/stl/bitset/) in STL
2. [bit\_vector](http://www.sgi.com/tech/stl/bit_vector.html) in SGI
3. [qbitarray](http://developer.qt.nokia.com/doc/qt-4.8/qbitarray.html) in QTL