boost::iostreams::basic_array_sink
models a SinkDevice
only, which gives you write-only semantics and no way of telling how many bytes have been written.
OTOH, its sibling boost::iostreams::basic_array
models a SeekableDevice
allowing to utilize the seek() member function of your stream:
namespace io = boost::iostreams;
char buffer[4096];
io::stream<io::basic_array<char> > source(buffer, buffer_size);
boost::archive::binary_oarchive oa(source);
oa << serializable_object;
// move current stream position to the end, io::seek() returns new position
std::cout << "Bytes written: "
<< io::seek(source, 0, std::ios_base::end)
<< std::endl;