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 10 #ifndef BOOST_BEAST_IMPL_STATIC_BUFFER_HPP 11 #define BOOST_BEAST_IMPL_STATIC_BUFFER_HPP 12 13 #include <boost/asio/buffer.hpp> 14 #include <stdexcept> 15 16 namespace boost { 17 namespace beast { 18 19 template<std::size_t N> 20 static_buffer<N>:: static_buffer(static_buffer const & other)21static_buffer(static_buffer const& other) noexcept 22 : static_buffer_base(buf_, N) 23 { 24 this->commit(net::buffer_copy( 25 this->prepare(other.size()), other.data())); 26 } 27 28 template<std::size_t N> 29 auto 30 static_buffer<N>:: operator =(static_buffer const & other)31operator=(static_buffer const& other) noexcept -> 32 static_buffer<N>& 33 { 34 if(this == &other) 35 return *this; 36 this->consume(this->size()); 37 this->commit(net::buffer_copy( 38 this->prepare(other.size()), other.data())); 39 return *this; 40 } 41 42 } // beast 43 } // boost 44 45 #endif 46