2004-11-28 03:35:12 +00:00
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en" >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" / >
2010-08-09 20:07:24 +00:00
< meta name = "generator" content = "Docutils 0.7: http://docutils.sourceforge.net/" / >
2004-11-28 03:35:12 +00:00
< title > The MPL Reference Manual: Forward Sequence< / title >
< link rel = "stylesheet" href = "../style.css" type = "text/css" / >
< / head >
< body class = "docframe refmanual" >
< table class = "header" > < tr class = "header" > < td class = "header-group navigation-bar" > < span class = "navigation-group" > < a href = "./concepts.html" class = "navigation-link" > Prev< / a > < a href = "./bidirectional-sequence.html" class = "navigation-link" > Next< / a > < / span > < span class = "navigation-group-separator" > | < / span > < span class = "navigation-group" > Back < a href = "./bidirectional-sequence.html" class = "navigation-link" > Along< / a > < / span > < span class = "navigation-group-separator" > | < / span > < span class = "navigation-group" > < a href = "./concepts.html" class = "navigation-link" > Up< / a > < a href = "../refmanual.html" class = "navigation-link" > Home< / a > < / span > < span class = "navigation-group-separator" > | < / span > < span class = "navigation-group" > < a href = "./refmanual_toc.html" class = "navigation-link" > Full TOC< / a > < / span > < / td >
< td class = "header-group page-location" > < a href = "../refmanual.html" class = "navigation-link" > Front Page< / a > / < a href = "./sequences.html" class = "navigation-link" > Sequences< / a > / < a href = "./concepts.html" class = "navigation-link" > Concepts< / a > / < a href = "./forward-sequence.html" class = "navigation-link" > Forward Sequence< / a > < / td >
< / tr > < / table > < div class = "header-separator" > < / div >
< div class = "section" id = "forward-sequence" >
2010-08-09 20:07:24 +00:00
< h1 > < a class = "toc-backref" href = "./concepts.html#id1395" > Forward Sequence< / a > < / h1 >
2004-11-28 03:35:12 +00:00
< div class = "section" id = "description" >
2009-08-17 11:30:52 +00:00
< h3 > Description< / h3 >
< p > A < a class = "reference internal" href = "./forward-sequence.html" > Forward Sequence< / a > is an MPL concept representing a compile-time sequence of
elements. Sequence elements are
types, and are accessible through < a class = "reference internal" href = "./iterators.html" > Iterators< / a > . The < a class = "reference internal" href = "./begin.html" > begin< / a > and < a class = "reference internal" href = "./end.html" > end< / a > metafunctions
provide iterators delimiting the range of the sequence
elements. A sequence guarantees that its elements are arranged in a definite,
but possibly unspecified, order. Every MPL sequence is a < a class = "reference internal" href = "./forward-sequence.html" > Forward Sequence< / a > .< / p >
2004-11-28 03:35:12 +00:00
< / div >
< div class = "section" id = "definitions" >
2009-08-17 11:30:52 +00:00
< h3 > Definitions< / h3 >
2004-11-28 03:35:12 +00:00
< ul class = "simple" >
2009-08-17 11:30:52 +00:00
< li > The < em > size< / em > of a sequence is the number of elements it contains. The size is a
2004-11-28 03:35:12 +00:00
nonnegative number.< / li >
< li > A sequence is < em > empty< / em > if its size is zero.< / li >
< / ul >
< / div >
< div class = "section" id = "expression-requirements" >
2009-08-17 11:30:52 +00:00
< h3 > Expression requirements< / h3 >
< p > For any < a class = "reference internal" href = "./forward-sequence.html" > Forward Sequence< / a > < tt class = "literal" > < span class = "pre" > s< / span > < / tt > the following expressions must be valid:< / p >
< table border = "1" class = "docutils table" >
2004-11-28 03:35:12 +00:00
< colgroup >
< col width = "30%" / >
< col width = "39%" / >
< col width = "30%" / >
< / colgroup >
< thead valign = "bottom" >
2009-08-17 11:30:52 +00:00
< tr > < th class = "head" > Expression< / th >
< th class = "head" > Type< / th >
< th class = "head" > Complexity< / th >
2004-11-28 03:35:12 +00:00
< / tr >
< / thead >
< tbody valign = "top" >
< tr > < td > < tt class = "literal" > < span class = "pre" > < a href = "./begin.html" class = "identifier" > begin< / a > < s> ::type< / span > < / tt > < / td >
2009-08-17 11:30:52 +00:00
< td > < a class = "reference internal" href = "./forward-iterator.html" > Forward Iterator< / a > < / td >
2004-11-28 03:35:12 +00:00
< td > Amortized constant time< / td >
< / tr >
< tr > < td > < tt class = "literal" > < span class = "pre" > < a href = "./end.html" class = "identifier" > end< / a > < s> ::type< / span > < / tt > < / td >
2009-08-17 11:30:52 +00:00
< td > < a class = "reference internal" href = "./forward-iterator.html" > Forward Iterator< / a > < / td >
2004-11-28 03:35:12 +00:00
< td > Amortized constant time< / td >
< / tr >
< tr > < td > < tt class = "literal" > < span class = "pre" > < a href = "./size.html" class = "identifier" > size< / a > < s> ::type< / span > < / tt > < / td >
2009-08-17 11:30:52 +00:00
< td > < a class = "reference internal" href = "./integral-constant.html" > Integral Constant< / a > < / td >
2004-11-28 03:35:12 +00:00
< td > Unspecified< / td >
< / tr >
< tr > < td > < tt class = "literal" > < span class = "pre" > < a href = "./empty.html" class = "identifier" > empty< / a > < s> ::type< / span > < / tt > < / td >
2009-08-17 11:30:52 +00:00
< td > Boolean < a class = "reference internal" href = "./integral-constant.html" > Integral Constant< / a > < / td >
2004-11-28 03:35:12 +00:00
< td > Constant time< / td >
< / tr >
< tr > < td > < tt class = "literal" > < span class = "pre" > < a href = "./front.html" class = "identifier" > front< / a > < s> ::type< / span > < / tt > < / td >
< td > Any type< / td >
< td > Amortized constant time< / td >
< / tr >
< / tbody >
< / table >
< / div >
< div class = "section" id = "expression-semantics" >
2009-08-17 11:30:52 +00:00
< h3 > Expression semantics< / h3 >
< table border = "1" class = "docutils table" >
2004-11-28 03:35:12 +00:00
< colgroup >
< col width = "28%" / >
< col width = "72%" / >
< / colgroup >
< thead valign = "bottom" >
2009-08-17 11:30:52 +00:00
< tr > < th class = "head" > Expression< / th >
< th class = "head" > Semantics< / th >
2004-11-28 03:35:12 +00:00
< / tr >
< / thead >
< tbody valign = "top" >
< tr > < td > < tt class = "literal" > < span class = "pre" > < a href = "./begin.html" class = "identifier" > begin< / a > < s> ::type< / span > < / tt > < / td >
2009-08-17 11:30:52 +00:00
< td > An iterator to the first element of the sequence; see < a class = "reference internal" href = "./begin.html" > begin< / a > .< / td >
2004-11-28 03:35:12 +00:00
< / tr >
< tr > < td > < tt class = "literal" > < span class = "pre" > < a href = "./end.html" class = "identifier" > end< / a > < s> ::type< / span > < / tt > < / td >
2009-08-17 11:30:52 +00:00
< td > A past-the-end iterator to the sequence; see < a class = "reference internal" href = "./end.html" > end< / a > .< / td >
2004-11-28 03:35:12 +00:00
< / tr >
< tr > < td > < tt class = "literal" > < span class = "pre" > < a href = "./size.html" class = "identifier" > size< / a > < s> ::type< / span > < / tt > < / td >
2009-08-17 11:30:52 +00:00
< td > The size of the sequence; see < a class = "reference internal" href = "./size.html" > size< / a > .< / td >
2004-11-28 03:35:12 +00:00
< / tr >
< tr > < td > < tt class = "literal" > < span class = "pre" > < a href = "./empty.html" class = "identifier" > empty< / a > < s> ::type< / span > < / tt > < / td >
2009-08-17 11:30:52 +00:00
< td > A boolean < a class = "reference internal" href = "./integral-constant.html" > Integral Constant< / a > < tt class = "literal" > < span class = "pre" > c< / span > < / tt > such that
< tt class = "literal" > < span class = "pre" > c::value< / span > < span class = "pre" > ==< / span > < span class = "pre" > true< / span > < / tt > if and only if the sequence is empty; see < a class = "reference internal" href = "./empty.html" > empty< / a > .< / td >
2004-11-28 03:35:12 +00:00
< / tr >
< tr > < td > < tt class = "literal" > < span class = "pre" > < a href = "./front.html" class = "identifier" > front< / a > < s> ::type< / span > < / tt > < / td >
2009-08-17 11:30:52 +00:00
< td > The first element in the sequence; see < a class = "reference internal" href = "./front.html" > front< / a > .< / td >
2004-11-28 03:35:12 +00:00
< / tr >
< / tbody >
< / table >
< / div >
< div class = "section" id = "invariants" >
2009-08-17 11:30:52 +00:00
< h3 > Invariants< / h3 >
< p > For any < a class = "reference internal" href = "./forward-sequence.html" > Forward Sequence< / a > < tt class = "literal" > < span class = "pre" > s< / span > < / tt > the following invariants always hold:< / p >
2004-11-28 03:35:12 +00:00
< ul class = "simple" >
< li > [< tt class = "literal" > < span class = "pre" > < a href = "./begin.html" class = "identifier" > begin< / a > < s> ::type< / span > < / tt > , < tt class = "literal" > < span class = "pre" > < a href = "./end.html" class = "identifier" > end< / a > < s> ::type< / span > < / tt > ) is always a valid range.< / li >
2009-08-17 11:30:52 +00:00
< li > An algorithm that iterates through the range [< tt class = "literal" > < span class = "pre" > < a href = "./begin.html" class = "identifier" > begin< / a > < s> ::type< / span > < / tt > , < tt class = "literal" > < span class = "pre" > < a href = "./end.html" class = "identifier" > end< / a > < s> ::type< / span > < / tt > )
2004-11-28 03:35:12 +00:00
will pass through every element of < tt class = "literal" > < span class = "pre" > s< / span > < / tt > exactly once.< / li >
< li > < tt class = "literal" > < span class = "pre" > < a href = "./begin.html" class = "identifier" > begin< / a > < s> ::type< / span > < / tt > is identical to < tt class = "literal" > < span class = "pre" > < a href = "./end.html" class = "identifier" > end< / a > < s> ::type< / span > < / tt > if and only if < tt class = "literal" > < span class = "pre" > s< / span > < / tt > is empty.< / li >
< li > Two different iterations through < tt class = "literal" > < span class = "pre" > s< / span > < / tt > will access its elements in the same order.< / li >
< / ul >
< / div >
< div class = "section" id = "models" >
2009-08-17 11:30:52 +00:00
< h3 > Models< / h3 >
2004-11-28 03:35:12 +00:00
< ul class = "simple" >
2009-08-17 11:30:52 +00:00
< li > < a class = "reference internal" href = "./vector.html" > vector< / a > < / li >
< li > < a class = "reference internal" href = "./map.html" > map< / a > < / li >
< li > < a class = "reference internal" href = "./range-c.html" > range_c< / a > < / li >
< li > < a class = "reference internal" href = "./iterator-range.html" > iterator_range< / a > < / li >
< li > < a class = "reference internal" href = "./filter-view.html" > filter_view< / a > < / li >
2004-11-28 03:35:12 +00:00
< / ul >
< / div >
< div class = "section" id = "see-also" >
2009-08-17 11:30:52 +00:00
< h3 > See also< / h3 >
< p > < a class = "reference internal" href = "./sequences.html" > Sequences< / a > , < a class = "reference internal" href = "./bidirectional-sequence.html" > Bidirectional Sequence< / a > , < a class = "reference internal" href = "./forward-iterator.html" > Forward Iterator< / a > , < a class = "reference internal" href = "./begin.html" > begin< / a > / < a class = "reference internal" href = "./end.html" > end< / a > , < a class = "reference internal" href = "./size.html" > size< / a > , < a class = "reference internal" href = "./empty.html" > empty< / a > , < a class = "reference internal" href = "./front.html" > front< / a > < / p >
2004-11-28 03:35:12 +00:00
<!-- Sequences/Concepts//Bidirectional Sequence |20 -->
< / div >
< / div >
< div class = "footer-separator" > < / div >
< table class = "footer" > < tr class = "footer" > < td class = "header-group navigation-bar" > < span class = "navigation-group" > < a href = "./concepts.html" class = "navigation-link" > Prev< / a > < a href = "./bidirectional-sequence.html" class = "navigation-link" > Next< / a > < / span > < span class = "navigation-group-separator" > | < / span > < span class = "navigation-group" > Back < a href = "./bidirectional-sequence.html" class = "navigation-link" > Along< / a > < / span > < span class = "navigation-group-separator" > | < / span > < span class = "navigation-group" > < a href = "./concepts.html" class = "navigation-link" > Up< / a > < a href = "../refmanual.html" class = "navigation-link" > Home< / a > < / span > < span class = "navigation-group-separator" > | < / span > < span class = "navigation-group" > < a href = "./refmanual_toc.html" class = "navigation-link" > Full TOC< / a > < / span > < / td >
2009-08-17 11:30:52 +00:00
< td > < div class = "copyright-footer" > < div class = "copyright" > Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams< / div >
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at < a class = "reference external" href = "http://www.boost.org/LICENSE_1_0.txt" target = "_top" > http://www.boost.org/LICENSE_1_0.txt< / a > )< / div > < / td > < / tr > < / table > < / body >
2004-11-28 03:35:12 +00:00
< / html >