I have an object that maintains three arbitrary precision (AP) integer keys. The caller may supply any of the keys by passing a pointer and a length; as the AP keys are of a templated type, they may change depending on the most optimal integer size, making passing arrays of bytes through an interface the only reasonable option that is agnostic of how it will be represented inside the AP integer.
So, there are two constructors: One that accepts up to three pointer-length pairs, and one that accepts parameters to generate the keys.
The biggest question is how the keys should be made accessible to the caller. It seems irrational to make the caller guess how big the buffer would be. My goal in asking is not really to find out how it is possible (I can think of a few ways), but to ask what would be most convenient and expected as a caller, as well as what is most likely to require the least amount of transformation into the desired format after retrieving it, like writing it to a file, or putting it in a vector.
If you were a caller, and had to get a yet unknown number of bytes from an object, how would you prefer that this interface be designed?