If you don't have any specific upper bound for the size of the numbers you need to store, then you need to store your data in two different dimensions:
- The first dimension will be the number, whose size varies.
- The second dimension will be your array of numbers.
For the latter, using std:vector
is fine if you require your values to be contiguous in memory. For the numbers themselves you don't need any data structure at all: just allocate memory using new
and an unsigned primitive type such as unsigned char
, uint8_t
or any other if you have alignment constraints.
If, on the other hand, you know that your numbers won't be larger than let's say 64 bits, then use a data type that you know will hold this amount of data such as uint64_t
.
PS: remember that what you store are numbers. The computer will store them in binary whether you use them as such or with any other representation.