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

source code of boost/libs/beast/include/boost/beast/core/impl/static_buffer.hpp