flat_static_buffer.hpp 1015 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/beast
  8. //
  9. #ifndef BOOST_BEAST_IMPL_FLAT_STATIC_BUFFER_HPP
  10. #define BOOST_BEAST_IMPL_FLAT_STATIC_BUFFER_HPP
  11. namespace boost {
  12. namespace beast {
  13. template<std::size_t N>
  14. flat_static_buffer<N>::
  15. flat_static_buffer(
  16. flat_static_buffer const& other)
  17. : flat_static_buffer_base(buf_, N)
  18. {
  19. this->commit(net::buffer_copy(
  20. this->prepare(other.size()), other.data()));
  21. }
  22. template<std::size_t N>
  23. auto
  24. flat_static_buffer<N>::
  25. operator=(flat_static_buffer const& other) ->
  26. flat_static_buffer<N>&
  27. {
  28. if(this == &other)
  29. return *this;
  30. this->consume(this->size());
  31. this->commit(net::buffer_copy(
  32. this->prepare(other.size()), other.data()));
  33. return *this;
  34. }
  35. } // beast
  36. } // boost
  37. #endif