Skip to content

Commit

Permalink
Add documentation for concepts
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtum committed Apr 15, 2024
1 parent d5a6330 commit 3dba41b
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 1 deletion.
76 changes: 76 additions & 0 deletions doc/modules/ROOT/pages/concepts/ConstBufferSequence.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,79 @@


= ConstBufferSequence

A __ConstBufferSequence__ represents a collection of `const_buffer` s or `mutable_buffer` s.


== Related Identifiers

`is_const_buffer_sequence`.


== Requirements

* `T` denotes a type meeting the requirements of __ConstBufferSequence__
* `t` denotes a const value of type `T`
* `u` denotes an identifier

[cols="1a,1a,3a"]
|===
// Headers
|Expression|Type|Semantics, Pre/Post-conditions

// Row 1, Column 1
|`T::value_type`
// Row 1, Column 2
|`const_buffer` or `mutable_buffer`
// Row 1, Column 3
|This type represents a buffer in the sequence.

// Row 2, Column 1
|`T::const_iterator`
// Row 2, Column 2
|
// Row 2, Column 3
|This type represents an iterator type that satisfies the requirements of `std::bidirectional_iterator` whose value type is `const_buffer` or `mutable_buffer`.

// Row 3, Column 1
|`t.begin()`
// Row 3, Column 2
|`T::const_iterator`
// Row 3, Column 3
|Returns an iterator to the first element of the sequence.

// Row 4, Column 1
|`t.end()`
// Row 4, Column 2
|`T::const_iterator`
// Row 4, Column 3
|Returns an iterator to the element following the last element of the sequence.

// Row 5, Column 1
|`T u(t)`;
// Row 5, Column 2
|
// Row 5, Column 3
|`T` satisfies the requirements of `std::copyconstructible` and `std::destructible`.

Post-conditions:
[source,cpp]
----
assert(std::ranges::size(t) == std::ranges::size(u));
for (auto elem : std::views::zip(t, u))
{
assert(std::get<0>(elem).data() == std::get<1>(elem).data());
assert(std::get<0>(elem).size() == std::get<1>(elem).size());
}
----

|===


== Models

* `const_buffer_span`
* `mutable_buffer_span`
* `const_buffer_pair`
* `mutable_buffer_pair`
73 changes: 73 additions & 0 deletions doc/modules/ROOT/pages/concepts/MutableBufferSequence.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,76 @@


= MutableBufferSequence

A __MutableBufferSequence__ represents a collection of `mutable_buffer` s.


== Related Identifiers

`is_mutable_buffer_sequence`.


== Requirements

* `T` denotes a type meeting the requirements of __MutableBufferSequence__
* `t` denotes a const value of type `T`

[cols="1a,1a,3a"]
|===
// Headers
|Expression|Type|Semantics, Pre/Post-conditions

// Row 1, Column 1
|`T::value_type`
// Row 1, Column 2
|`mutable_buffer`
// Row 1, Column 3
|This type represents a mutable buffer in the sequence.

// Row 2, Column 1
|`T::const_iterator`
// Row 2, Column 2
|
// Row 2, Column 3
|This type represents an iterator type that satisfies the requirements of `std::bidirectional_iterator`.

// Row 3, Column 1
|`t.begin()`
// Row 3, Column 2
|`T::const_iterator`
// Row 3, Column 3
|Returns an iterator to the first element of the sequence.

// Row 4, Column 1
|`t.end()`
// Row 4, Column 2
|`T::const_iterator`
// Row 4, Column 3
|Returns an iterator to the element following the last element of the sequence.

// Row 5, Column 1
|`T u(t)`;
// Row 5, Column 2
|
// Row 5, Column 3
|`T` satisfies the requirements of `std::copyconstructible` and `std::destructible`.

Post-conditions:
[source,cpp]
----
assert(std::ranges::size(t) == std::ranges::size(u));
for (auto elem : std::views::zip(t, u))
{
assert(std::get<0>(elem).data() == std::get<1>(elem).data());
assert(std::get<0>(elem).size() == std::get<1>(elem).size());
}
----

|===


== Models

* `mutable_buffer_span`
* `mutable_buffer_pair`
2 changes: 1 addition & 1 deletion doc/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ To use the library as header-only; that is, to eliminate the requirement
to link a program to a static or dynamic Boost.URL library, simply place
the following line in *exactly one* source file in your project.

[source, cpp]
[source,cpp]
----
#include <boost/buffers/src.hpp>
----
Expand Down

0 comments on commit 3dba41b

Please sign in to comment.