From 8aa35da4c40d8c7ee9bf73cf5960a9a894014798 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sun, 22 Mar 2015 09:45:17 +0900 Subject: [PATCH] Add documents for No-bounds sequences. --- doc/fusion.qbk | 4 +++ doc/html/index.html | 4 +++ doc/iterator.qbk | 6 ++++ doc/sequence.qbk | 68 +++++++++++++++++++++++++++++++++++++++++++-- doc/support.qbk | 2 ++ 5 files changed, 81 insertions(+), 3 deletions(-) diff --git a/doc/fusion.qbk b/doc/fusion.qbk index 81542f02..5233aade 100644 --- a/doc/fusion.qbk +++ b/doc/fusion.qbk @@ -79,6 +79,7 @@ [def __bidirectional_iterator__ [link fusion.iterator.concepts.bidirectional_iterator Bidirectional Iterator]] [def __random_access_iterator__ [link fusion.iterator.concepts.random_access_iterator Random Access Iterator]] [def __associative_iterator__ [link fusion.iterator.concepts.associative_iterator Associative Iterator]] +[def __no_bounds_iterator__ [link fusion.iterator.concepts.no_bounds_iterator No-bounds Iterator]] [def __next__ [link fusion.iterator.functions.next `next`]] [def __prior__ [link fusion.iterator.functions.prior `prior`]] @@ -108,6 +109,7 @@ [def __bidirectional_sequence__ [link fusion.sequence.concepts.bidirectional_sequence Bidirectional Sequence]] [def __random_access_sequence__ [link fusion.sequence.concepts.random_access_sequence Random Access Sequence]] [def __associative_sequence__ [link fusion.sequence.concepts.associative_sequence Associative Sequence]] +[def __no_bounds_sequence__ [link fusion.sequence.concepts.no_bounds_sequence No-bounds Sequence]] [def __containers__ [link fusion.container Container]] [def __vector__ [link fusion.container.vector `vector`]] @@ -337,6 +339,8 @@ [def __adt_attribute_proxy__ [link fusion.notes.adt_attribute_proxy `adt_attribute_proxy`]] +[def __window_function__ [@http://en.wikipedia.org/wiki/Window_function Window Function]] + [include preface.qbk] [include introduction.qbk] [include quick_start.qbk] diff --git a/doc/html/index.html b/doc/html/index.html index 0fd880b6..626cf2e5 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -69,6 +69,8 @@ Access Iterator
Associative Iterator
+
No-bounds + Iterator
Functions
@@ -116,6 +118,8 @@ Access Sequence
Associative Sequence
+
No-bounds + Sequence
Intrinsic
diff --git a/doc/iterator.qbk b/doc/iterator.qbk index d400003c..121ef123 100644 --- a/doc/iterator.qbk +++ b/doc/iterator.qbk @@ -257,6 +257,12 @@ expressions must be valid: [endsect] +[section No-bounds Iterator] + +[warning In this release, __no_bounds_iterator__ concept has no effect. It's reserved for future release.] + +[endsect] + [endsect] [section Functions] diff --git a/doc/sequence.qbk b/doc/sequence.qbk index 5957a6e1..8fc4ce9e 100644 --- a/doc/sequence.qbk +++ b/doc/sequence.qbk @@ -39,6 +39,11 @@ These concepts pertain to sequence traversal. The __associative_sequence__ concept is orthogonal to traversal. An Associative Sequence allows efficient retrieval of elements based on keys. +[heading Boundary] + +The __no_bounds_sequence__ concept is also orthogonal to traversal and associativity. +A No-bounds Sequence allows out-of-bounds access. + [section Forward Sequence] [heading Description] @@ -359,6 +364,55 @@ you can use `__result_of_value_at_key__`.] [endsect] +[section No-bounds Sequence] + +[heading Description] + +A No-bounds Sequence allows Out-of-Bounds access: it will achieve something like a __window_function__. +Most of the sequences do not meet this concept, but some special usecases do. + +[important User extending sequences should handle any parameters or be SFINAE-friendly.] + +[variablelist Notation + [[`s`] [An Fusion Sequence]] + [[`S`] [An Fusion Sequence type]] + [[`M`] [An __mpl__ integral constant]] + [[`N`] [An integral constant]] + [[`K`] [An arbitrary /key/ type]] + [[`o`] [An arbitrary object]] + [[`e`] [A Sequence element]] +] + +[heading Valid Expressions] + +[table + [[Expression] [Return type] [Type Requirements] [Runtime Complexity]] + [[`__at_c__(s)`] [Any type] [] [Depends on its traversability]] + [[`__at_c__(s) = o`] [Any type] [] [Depends on its traversability]] + [[`__at__(s)`] [Any type] [] [Depends on its traversability]] + [[`__at__(s) = o`] [Any type] [] [Depends on its traversability]] + [[`__at_key__(s)`] [Any type] [`S` should be __associative_sequence__] [Depends on its traversability]] + [[`__at_key__(s) = o`] [Any type] [`S` should be __associative_sequence__] [Depends on its traversability]] +] + +[heading Result Type Expressions] + +[table + [[Expression] [Compile Time Complexity]] + [[`__result_of_at__::type`] [Depends on its traversability]] + [[`__result_of_at_c__::type`] [Depends on its traversability]] + [[`__result_of_value_at__::type`] [Depends on its traversability]] + [[`__result_of_value_at_c__::type`] [Depends on its traversability]] + [[`__result_of_at_key__::type`] [Depends on its traversability]] + [[`__result_of_value_at_key__::type`] [Depends on its traversability]] +] + +[heading Models] + +* none. + +[endsect] + [endsect] [section Intrinsic] @@ -686,7 +740,7 @@ element from the beginning of the sequence, is a valid expression. Else, returns a type convertible to the M-th element from the beginning of the sequence. -[*Precondition]: `0 <= M::value < __size__(s)` +[*Precondition]: `0 <= M::value < __size__(seq)` (where `seq` is not __no_bounds_sequence__) [*Semantics]: Equivalent to @@ -739,7 +793,7 @@ element from the beginning of the sequence, is a valid expression. Else, returns a type convertible to the N-th element from the beginning of the sequence. -[*Precondition]: `0 <= N < __size__(s)` +[*Precondition]: `0 <= N < __size__(seq)` (where `seq` is not __no_bounds_sequence__) [*Semantics]: Equivalent to @@ -833,7 +887,7 @@ the sequence `seq` if `seq` is mutable and `e = o`, where `e` is the element associated with Key, is a valid expression. Else, returns a type convertible to the element associated with Key. -[*Precondition]: `has_key(seq) == true` +[*Precondition]: `has_key(seq) == true` (where `seq` is not __no_bounds_sequence__) [*Semantics]: Returns the element associated with Key. @@ -1149,6 +1203,8 @@ the actual element type, use __result_of_value_at__]. [*Return type]: Any type. +[*Precondition]: `0 <= M::value < __result_of_size__::value` (where `Seq` is not __no_bounds_sequence__) + [*Semantics]: Returns the result type of using __at__ to access the `M`th element of `Seq`. [heading Header] @@ -1191,6 +1247,8 @@ get the actual element type, use __result_of_value_at_c__]. [*Return type]: Any type +[*Precondition]: `0 <= N < __result_of_size__::value` (where `Seq` is not __no_bounds_sequence__) + [*Semantics]: Returns the result type of using __at_c__ to access the `N`th element of `Seq`. [heading Header] @@ -1350,6 +1408,8 @@ you want to get the actual element type, use __result_of_value_at_key__]. [*Return type]: Any type. +[*Precondition]: `has_key::type::value == true` (where `Seq` is not __no_bounds_sequence__) + [*Semantics]: Returns the result of using __at_key__ to access the element with key type `Key` in `Seq`. [heading Header] @@ -1388,6 +1448,8 @@ Returns the actual element type associated with a Key from the __sequence__. [*Return type]: Any type. +[*Precondition]: `has_key::type::value == true` (where `Seq` is not __no_bounds_sequence__) + [*Semantics]: Returns the actual element type associated with key type `Key` in `Seq`. diff --git a/doc/support.qbk b/doc/support.qbk index 3e7b7a70..c7c48741 100644 --- a/doc/support.qbk +++ b/doc/support.qbk @@ -227,6 +227,8 @@ And optionally from: namespace boost { namespace fusion { struct associative_tag {}; + + struct no_bounds_tag {}; }} [*Semantics]: Establishes the conceptual classification of a particular