# Forward Container Category: containers Component type: concept

### Description

A Forward Container is a Container whose elements are arranged in a definite order: the ordering will not change spontaneously from iteration to iteration. The requirement of a definite ordering allows the definition of element-by-element equality (if the container's element type is Equality Comparable) and of lexicographical ordering (if the container's element type is LessThan Comparable).

Iterators into a Forward Container satisfy the forward iterator requirements; consequently, Forward Containers support multipass algorithms and allow multiple iterators into the same container to be active at the same time.

### Refinement of

Container, EqualityComparable, LessThanComparable

### Associated types

No additional types beyond those defined in Container. However, the requirements for the iterator type are strengthened: the iterator type must be a model of Forward Iterator.

### Notation

 X A type that is a model of Forward Container a, b Object of type X T The value type of X

### Valid expressions

In addition to the expressions defined in Container, EqualityComparable, and LessThanComparable, the following expressions must be valid.
Name Expression Type requirements Return type
Equality a == b T is EqualityComparable Convertible to bool
Inequality a != b T is EqualityComparable Convertible to bool
Less a < b T is LessThanComparable Convertible to bool
Greater a > b T is LessThanComparable Convertible to bool
Less or equal a <= b T is LessThanComparable Convertible to bool
Greater or equal a >= b T is LessThanComparable Convertible to bool

### Expression semantics

Semantics of an expression is defined only where it is not defined in Container, EqualityComparable, or LessThanComparable, or where there is additional information.
Name Expression Precondition Semantics Postcondition
Equality a == b   Returns true if a.size() == b.size() and if each element of a compares equal to the corresponding element of b. Otherwise returns false.
Less a < b   Equivalent to lexicographical_compare(a,b)

### Complexity guarantees

The equality and inequality operations are linear in the container's size.

### Invariants

 Ordering Two different iterations through a forward container will access its elements in the same order, providing that there have been no intervening mutative operations.

### Notes
{"ft_lang_label":"__label__en","ft_lang_prob":0.7305427,"math_prob":0.95036566,"size":2151,"snap":"2020-34-2020-40","text_gpt3_token_len":458,"char_repetition_ratio":0.1555659,"word_repetition_ratio":0.012658228,"special_character_ratio":0.18967922,"punctuation_ratio":0.10810811,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9641446,"pos_list":[0,1,2,3,4,5,6,7,8,9,10],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-09-19T13:02:04Z\",\"WARC-Record-ID\":\"<urn:uuid:b297da34-3a98-4c18-812d-205c5dbe0f35>\",\"Content-Length\":\"8038\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:f3841409-0d75-4c2f-addf-22c0fc0b775a>\",\"WARC-Concurrent-To\":\"<urn:uuid:791a3a12-a781-4093-a473-0f6afc30fd3c>\",\"WARC-IP-Address\":\"146.20.110.251\",\"WARC-Target-URI\":\"https://www.boost.org/sgi/stl/ForwardContainer.html\",\"WARC-Payload-Digest\":\"sha1:BQD5O4G2NLJOXANEEDOM3PNVJYRAXOUJ\",\"WARC-Block-Digest\":\"sha1:PLSTI5X3NQUMTVQIANEDHPGPA7OZFQ32\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-40/CC-MAIN-2020-40_segments_1600400191780.21_warc_CC-MAIN-20200919110805-20200919140805-00642.warc.gz\"}"}