I think you are looking for this:
boost::asio::async_write(serialPort, make_buffer(vector_.front()) );
where make_buffer is defined as:
template<typename TBuffer> boost::asio::buffer make_buffer(TBuffer & data) { auto buf = boost::asio::buffer_cast<const void*>(data); auto size= boost::asio::buffer_size(data); return boost::asio::buffer(buf, size); }
which, by the way, is a common function.
Nawaz
source share