File: MutableBufferSequence.qbk

package info (click to toggle)
boost1.35 1.35.0-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 203,856 kB
  • ctags: 337,867
  • sloc: cpp: 938,683; xml: 56,847; ansic: 41,589; python: 18,999; sh: 11,566; makefile: 664; perl: 494; yacc: 456; asm: 353; csh: 6
file content (102 lines) | stat: -rw-r--r-- 2,700 bytes parent folder | download
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
95
96
97
98
99
100
101
102
[/
 / Copyright (c) 2003-2008 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:MutableBufferSequence Mutable buffer sequence requirements]

In the table below, `X` denotes a class containing objects of type `T`, `a`
denotes a value of type `X` and `u` denotes an identifier.

[table MutableBufferSequence requirements
  [[expression] [return type] [assertion/note\npre/post-condition]]
  [
    [`X::value_type`]
    [`T`]
    [`T` meets the requirements for [link
     boost_asio.reference.ConvertibleToMutableBuffer
     ConvertibleToMutableBuffer].]
  ]
  [
    [`X::const_iterator`]
    [iterator type pointing to `T`]
    [`const_iterator` meets the requirements for bidirectional iterators
     (C++ Std, 24.1.4).]
  ]
  [
    [`X(a);`]
    []
    [post: `equal_mutable_buffer_seq(a, X(a))` where the binary predicate
     `equal_mutable_buffer_seq` is defined as
     ``
       bool equal_mutable_buffer_seq(
         const X& x1, const X& x2)
       {
         return
           distance(x1.begin(), x1.end())
             == distance(x2.begin(), x2.end())
               && equal(x1.begin(), x1.end(),
                        x2.begin(), equal_buffer);
       }
     ``
     and the binary predicate `equal_buffer` is defined as
     ``
      bool equal_buffer(
        const X::value_type& v1,
        const X::value_type& v2)
      {
        mutable_buffer b1(v1);
        mutable_buffer b2(v2);
        return
          buffer_cast<const void*>(b1)
            == buffer_cast<const void*>(b2)
              && buffer_size(b1) == buffer_size(b2);
      }
     ``]
  ]
  [
    [`X u(a);`]
    []
    [post:
     ``
      distance(a.begin(), a.end())
        == distance(u.begin(), u.end())
          && equal(a.begin(), a.end(),
                   u.begin(), equal_buffer)
     ``
     where the binary predicate `equal_buffer` is defined as
     ``
      bool equal_buffer(
        const X::value_type& v1,
        const X::value_type& v2)
      {
        mutable_buffer b1(v1);
        mutable_buffer b2(v2);
        return
          buffer_cast<const void*>(b1)
            == buffer_cast<const void*>(b2)
              && buffer_size(b1) == buffer_size(b2);
      }
     ``]
  ]
  [
    [`(&a)->~X();`]
    [`void`]
    [note: the destructor is applied to every element of `a`; all the memory
     is deallocated.]
  ]
  [
    [`a.begin();`]
    [`const_iterator` or convertible to `const_iterator`]
    []
  ]
  [
    [`a.end();`]
    [`const_iterator` or convertible to `const_iterator`]
    []
  ]
]

[endsect]