diff --git a/doc/fusion.qbk b/doc/fusion.qbk
index 81542f02..0a24cb32 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 __unbounded_iterator__ [link fusion.iterator.concepts.unbounded_iterator Unbounded 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 __unbounded_sequence__ [link fusion.sequence.concepts.unbounded_sequence Unbounded 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..957609a9 100644
--- a/doc/html/index.html
+++ b/doc/html/index.html
@@ -69,6 +69,8 @@
Access Iterator
Associative
Iterator
+Unbounded
+ Iterator
Functions
@@ -116,6 +118,8 @@
Access Sequence
- Associative
Sequence
+- Unbounded
+ Sequence
Intrinsic
@@ -274,7 +278,7 @@
-Last revised: May 10, 2013 at 05:54:18 GMT |
+Last revised: June 25, 2015 at 13:41:27 GMT |
|
diff --git a/doc/iterator.qbk b/doc/iterator.qbk
index d400003c..ef33240a 100644
--- a/doc/iterator.qbk
+++ b/doc/iterator.qbk
@@ -257,6 +257,12 @@ expressions must be valid:
[endsect]
+[section Unbounded Iterator]
+
+[warning In this release, __unbounded_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..a9fc83d3 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 __unbounded_sequence__ concept is also orthogonal to traversal and associativity.
+A Unbounded 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 Unbounded Sequence]
+
+[heading Description]
+
+A Unbounded 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 __unbounded_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 __unbounded_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 __unbounded_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 __unbounded_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 __unbounded_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 __unbounded_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 __unbounded_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..3e3b8a4e 100644
--- a/doc/support.qbk
+++ b/doc/support.qbk
@@ -227,6 +227,8 @@ And optionally from:
namespace boost { namespace fusion
{
struct associative_tag {};
+
+ struct unbounded_tag {};
}}
[*Semantics]: Establishes the conceptual classification of a particular
diff --git a/include/boost/fusion/sequence/intrinsic/at.hpp b/include/boost/fusion/sequence/intrinsic/at.hpp
index fdfa72a6..a103e078 100644
--- a/include/boost/fusion/sequence/intrinsic/at.hpp
+++ b/include/boost/fusion/sequence/intrinsic/at.hpp
@@ -10,12 +10,13 @@
#include
#include
#include
+#include
#include
#include
#include
#include
#include
-#include
+#include
namespace boost { namespace fusion
{
@@ -64,7 +65,10 @@ namespace boost { namespace fusion
template
struct at_impl
: mpl::if_<
- mpl::less::template apply::type>
+ mpl::or_<
+ mpl::less::template apply::type>
+ , traits::is_unbounded
+ >
, typename extension::at_impl::template apply
, mpl::empty_base
>::type
diff --git a/include/boost/fusion/sequence/intrinsic/at_key.hpp b/include/boost/fusion/sequence/intrinsic/at_key.hpp
index 4693a905..9454cb56 100644
--- a/include/boost/fusion/sequence/intrinsic/at_key.hpp
+++ b/include/boost/fusion/sequence/intrinsic/at_key.hpp
@@ -11,10 +11,15 @@
#include
#include
#include
+#include
#include
#include
#include
+#include
#include
+#include
+#include
+#include
namespace boost { namespace fusion
{
@@ -64,12 +69,26 @@ namespace boost { namespace fusion
struct at_key_impl;
}
+ namespace detail
+ {
+ template
+ struct at_key_impl
+ : mpl::if_<
+ mpl::or_<
+ typename extension::has_key_impl::template apply
+ , traits::is_unbounded
+ >
+ , typename extension::at_key_impl::template apply
+ , mpl::empty_base
+ >::type
+ {};
+ }
+
namespace result_of
{
template
struct at_key
- : extension::at_key_impl::type>::
- template apply
+ : detail::at_key_impl::type>
{};
}
diff --git a/include/boost/fusion/sequence/intrinsic/value_at.hpp b/include/boost/fusion/sequence/intrinsic/value_at.hpp
index 362669b5..152f0c94 100644
--- a/include/boost/fusion/sequence/intrinsic/value_at.hpp
+++ b/include/boost/fusion/sequence/intrinsic/value_at.hpp
@@ -9,8 +9,13 @@
#include
#include
+#include
+#include
+#include
+#include
#include
#include
+#include
namespace boost { namespace fusion
{
@@ -50,12 +55,26 @@ namespace boost { namespace fusion
struct value_at_impl;
}
+ namespace detail
+ {
+ template
+ struct value_at_impl
+ : mpl::if_<
+ mpl::or_<
+ mpl::less::template apply::type>
+ , traits::is_unbounded
+ >
+ , typename extension::value_at_impl::template apply
+ , mpl::empty_base
+ >::type
+ {};
+ }
+
namespace result_of
{
template
struct value_at
- : extension::value_at_impl::type>::
- template apply
+ : detail::value_at_impl::type>
{};
template
diff --git a/include/boost/fusion/sequence/intrinsic/value_at_key.hpp b/include/boost/fusion/sequence/intrinsic/value_at_key.hpp
index 6d8be3fb..76baf1b8 100644
--- a/include/boost/fusion/sequence/intrinsic/value_at_key.hpp
+++ b/include/boost/fusion/sequence/intrinsic/value_at_key.hpp
@@ -10,10 +10,15 @@
#include
#include
+#include
+#include
+#include
#include
+#include
#include
#include
#include
+#include
namespace boost { namespace fusion
{
@@ -52,13 +57,27 @@ namespace boost { namespace fusion
template <>
struct value_at_key_impl;
}
-
+
+ namespace detail
+ {
+ template
+ struct value_at_key_impl
+ : mpl::if_<
+ mpl::or_<
+ typename extension::has_key_impl::template apply
+ , traits::is_unbounded
+ >
+ , typename extension::value_at_key_impl::template apply
+ , mpl::empty_base
+ >::type
+ {};
+ }
+
namespace result_of
{
template
struct value_at_key
- : extension::value_at_key_impl::type>::
- template apply
+ : detail::value_at_key_impl::type>
{};
}
}}
diff --git a/include/boost/fusion/support/category_of.hpp b/include/boost/fusion/support/category_of.hpp
index 6bdf6d02..92b0ea1b 100644
--- a/include/boost/fusion/support/category_of.hpp
+++ b/include/boost/fusion/support/category_of.hpp
@@ -36,6 +36,8 @@ namespace boost { namespace fusion
struct associative_tag {};
+ struct unbounded_tag {};
+
namespace extension
{
template
@@ -107,6 +109,13 @@ namespace boost { namespace fusion
random_access_traversal_tag
, typename category_of::type>
{};
+
+ template
+ struct is_unbounded
+ : is_base_of<
+ unbounded_tag
+ , typename category_of::type>
+ {};
}
}}