Guest User

Untitled

a guest
May 21st, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. template<class MutableBufferSequence>
  2. std::size_t read(MutableBufferSequence const&)
  3. {
  4. throw std::exception{};
  5. }
  6.  
  7. void
  8. example()
  9. {
  10. std::string s;
  11. assert(s.empty());
  12. try
  13. {
  14. auto b = boost::asio::dynamic_buffer(s);
  15. b.commit(read(b.prepare(32)));
  16. }
  17. catch(std::exception const&)
  18. {
  19. assert(s.empty()); // fails
  20. }
  21. }
Add Comment
Please, Sign In to add comment