File: DynamicBuffer_v2.qbk

package info (click to toggle)
boost1.74 1.74.0-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 464,084 kB
  • sloc: cpp: 3,338,324; xml: 131,293; python: 33,088; ansic: 14,336; asm: 4,034; sh: 3,351; makefile: 1,193; perl: 1,036; yacc: 478; php: 212; ruby: 102; lisp: 24; sql: 13; csh: 6
file content (94 lines) | stat: -rw-r--r-- 3,175 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
[/
 / Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
 /
 / Distributed under the Boost Software License, Version 1.0. (See accompanying
 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 /]

[section:DynamicBuffer_v2 Dynamic buffer requirements (version 2)]

A dynamic buffer encapsulates memory storage that may be automatically resized
as required.

A dynamic buffer type `X` shall satisfy the requirements of `CopyConstructible`
(C++ Std, [copyconstructible]) types in addition to those listed below.

In the table below, `X` denotes a dynamic buffer class, `x` denotes a value of
type `X&`, `x1` denotes values of type `const X&`, `pos` and `n` denote values
of type `size_t`, and `u` denotes an identifier.

[table DynamicBuffer_v2 requirements
  [[expression] [type] [assertion/note[br]pre/post-conditions]]
  [
    [`X::const_buffers_type`]
    [type meeting [link boost_asio.reference.ConstBufferSequence ConstBufferSequence]
     requirements.]
    [This type represents the underlying memory as a sequence of @c const_buffer
     objects.]
  ]
  [
    [`X::mutable_buffers_type`]
    [type meeting [link boost_asio.reference.MutableBufferSequence MutableBufferSequence]
     requirements.]
    [This type represents the underlying memory as a sequence of @c
     mutable_buffer objects.]
  ]
  [
    [`x1.size()`]
    [`size_t`]
    [Returns the size, in bytes, of the underlying memory.]
  ]
  [
    [`x1.max_size()`]
    [`size_t`]
    [Returns the permitted maximum size of the underlying memory.]
  ]
  [
    [`x1.capacity()`]
    [`size_t`]
    [Returns the maximum size to which the underlying memory can grow without
     requiring reallocation.]
  ]
  [
    [`x1.data(pos, n)`]
    [`X::const_buffers_type`]
    [Returns a constant buffer sequence `u` that represents the underlying
     memory beginning at offset `pos`, and where `buffer_size(u) <= n`.]
  ]
  [
    [`x.data(pos, n)`]
    [`X::mutable_buffers_type`]
    [Returns a mutable buffer sequence `u` that represents the underlying
     memory beginning at offset `pos`, and where `buffer_size(u) <= n`.]
  ]
  [
    [`x.grow(n)`]
    []
    [Requires: `size() + n <= max_size()`.[br]
     [br]
     Extends the underlying memory to accommodate `n` additional bytes at the
     end. The dynamic buffer reallocates memory as required. All constant or
     mutable buffer sequences previously obtained using `data()` are
     invalidated.[br]
     [br]
     Throws: `length_error` if `size() + n > max_size()`.]
  ]
  [
    [`x.shrink(n)`]
    []
    [Removes `n` bytes from the end of the underlying memory. If `n` is greater
     than the size of the underlying memory, the entire underlying memory is
     emptied. All constant or mutable buffer sequences previously obtained
     using `data()` are invalidated.]
  ]
  [
    [`x.consume(n)`]
    []
    [Removes `n` bytes from the beginning of the underlying memory. If `n` is
     greater than the size of the underlying memory, the entire underlying memory
     is emptied. All constant or mutable buffer sequences previously obtained
     using `data()` are invalidated.]
  ]
]

[endsect]