]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/asio/doc/requirements/MutableBufferSequence.qbk
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / asio / doc / requirements / MutableBufferSequence.qbk
1 [/
2 / Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff 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
8 [section:MutableBufferSequence Mutable buffer sequence requirements]
9
10 In the table below, `X` denotes a class containing objects of type `T`, `a`
11 denotes a value of type `X` and `u` denotes an identifier.
12
13 [table MutableBufferSequence requirements
14 [[expression] [return type] [assertion/note\npre/post-condition]]
15 [
16 [`X::value_type`]
17 [`T`]
18 [`T` meets the requirements for [link
19 boost_asio.reference.ConvertibleToMutableBuffer
20 ConvertibleToMutableBuffer].]
21 ]
22 [
23 [`X::const_iterator`]
24 [iterator type pointing to `T`]
25 [`const_iterator` meets the requirements for bidirectional iterators
26 (C++ Std, 24.1.4).]
27 ]
28 [
29 [`X(a);`]
30 []
31 [post: `equal_mutable_buffer_seq(a, X(a))` where the binary predicate
32 `equal_mutable_buffer_seq` is defined as
33 ``
34 bool equal_mutable_buffer_seq(
35 const X& x1, const X& x2)
36 {
37 return
38 distance(x1.begin(), x1.end())
39 == distance(x2.begin(), x2.end())
40 && equal(x1.begin(), x1.end(),
41 x2.begin(), equal_buffer);
42 }
43 ``
44 and the binary predicate `equal_buffer` is defined as
45 ``
46 bool equal_buffer(
47 const X::value_type& v1,
48 const X::value_type& v2)
49 {
50 mutable_buffer b1(v1);
51 mutable_buffer b2(v2);
52 return
53 buffer_cast<const void*>(b1)
54 == buffer_cast<const void*>(b2)
55 && buffer_size(b1) == buffer_size(b2);
56 }
57 ``]
58 ]
59 [
60 [`X u(a);`]
61 []
62 [post:
63 ``
64 distance(a.begin(), a.end())
65 == distance(u.begin(), u.end())
66 && equal(a.begin(), a.end(),
67 u.begin(), equal_buffer)
68 ``
69 where the binary predicate `equal_buffer` is defined as
70 ``
71 bool equal_buffer(
72 const X::value_type& v1,
73 const X::value_type& v2)
74 {
75 mutable_buffer b1(v1);
76 mutable_buffer b2(v2);
77 return
78 buffer_cast<const void*>(b1)
79 == buffer_cast<const void*>(b2)
80 && buffer_size(b1) == buffer_size(b2);
81 }
82 ``]
83 ]
84 [
85 [`(&a)->~X();`]
86 [`void`]
87 [note: the destructor is applied to every element of `a`; all the memory
88 is deallocated.]
89 ]
90 [
91 [`a.begin();`]
92 [`const_iterator` or convertible to `const_iterator`]
93 []
94 ]
95 [
96 [`a.end();`]
97 [`const_iterator` or convertible to `const_iterator`]
98 []
99 ]
100 ]
101
102 [endsect]