Topic: ISO/IEC-14882:2003 - Algorithms library


Author: "Joe Smith" <unknown_kev_cat@hotmail.com>
Date: Sun, 15 Nov 2009 00:48:02 CST
Raw View
"Greg Herlihy" <greghe@mac.com> wrote in message
news:b62f01c4-ee8d-4c36-b89c-cf2a2469710d@b15g2000yqd.googlegroups.com...
>
> On Nov 13, 12:57 pm, "subramanian10...@yahoo.com, India"
> <subramanian10...@yahoo.com> wrote:
>>
>> So a sequence is an alternative terminology for iterator range. Am I
>> correct ?
>
> The official ISO definition of a sequence is "An ordered list of zero
> or more items."
> [ISO 14977/3.1]

But ISO 14977 is not a normative reference for the C++ standard. Only
any definition from ISO/IEC 2382 would be applicable, since that is
the only standard the C++ standard fully includes by reference
(although not using that phrasing for some reason). Definitions from
other standards are incoporated only by explict reference to sections
of said documents.

Now, if ISO/IEC 2382 includes the defintion from ISO 14977 by
reference, then it would qualify as a defintion in ISO/IEC 2382, so
the definition would also be part of the C++ standard, but barring
that, any definition in ISO 14977 would be moot.

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: Greg Herlihy <greghe@mac.com>
Date: Sun, 15 Nov 2009 19:05:56 CST
Raw View
On Nov 15, 1:48 am, "Joe Smith" <unknown_kev_...@hotmail.com> wrote:
> "Greg Herlihy" <gre...@mac.com> wrote in message
>
> news:b62f01c4-ee8d-4c36-b89c-cf2a2469710d@b15g2000yqd.googlegroups.com...
>
>
>
> > On Nov 13, 12:57 pm, "subramanian10...@yahoo.com, India"
> > <subramanian10...@yahoo.com> wrote:
>
> >> So a sequence is an alternative terminology for iterator range. Am I
> >> correct ?
>
> > The official ISO definition of a sequence is "An ordered list of zero
> > or more items."
> > [ISO 14977/3.1]

> Now, if ISO/IEC 2382 includes the defintion from ISO 14977 by
> reference, then it would qualify as a defintion in ISO/IEC 2382, so
> the definition would also be part of the C++ standard.

Clearly this definition of "sequence" for C++ must included by direct
or indirect reference. How would I have found it otherwise?

Greg






--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: James Kanze <james.kanze@gmail.com>
Date: Mon, 16 Nov 2009 13:40:51 CST
Raw View
On Nov 13, 5:57 pm, "subramanian10...@yahoo.com, India"
<subramanian10...@yahoo.com> wrote:
> *) On Nov 11, 1:20 am, James Kanze <james.ka...@gmail.com> wrote:
> > On Nov 9, 6:27 pm, "subramanian10...@yahoo.com, India"

> > <subramanian10...@yahoo.com> wrote:
> > > In the ISO/IEC-14882:2003 document, the clause -
> > > '25 Algorithms library' contains
> > > 25.1 Non-modifying sequence operations
> > > 25.2 Mutating sequence operations
> > > 25.3 sorting and related operations
> > > 25.4 C library algorithms
> > > Here the first two sub-clauses namely 25.1 and 25.2
> > > mention "sequence" operations. My question is why these
> > > two sets of algorithms are named as "sequence" operations
> > > ? What does the name 'sequence' here mean ?  Since all the
> > > algorithms work on iterator ranges and they do not know
> > > anything about the underlying container type, the word
> > > 'sequence' in 25.1 and 25.2 cannot refer to sequence
> > > containers as the underlying data structures.

> > A pair of iterators defines a sequence.  Functions which
> > take a pair of iterators are functions which operate on a
> > sequence.

> So a sequence is an alternative terminology for iterator
> range. Am I correct ?

In this context, more or less.  The titles are really only used
for grouping, and don't have any normative effect on the
functions in the chapter.  In this regard, sequence really has
its everyday meaning, more or less what Greg quoted.  As it
happens, however, the way a sequence is specified to the
functions is by a pair of iterators; sequences that can't be
specified by a pair of iterators aren't supported (but arguably,
if you can't define a pair of iterators which specify it, it
isn't a sequence).

It's a bit misfortunate in that the standard does define
"sequence" elsewhere [lib.sequence.reqmts], with a definition
which is really irrelevant here.  ("A sequence is a kind of a
container", where as there's absolutely no requirement in the
algorithms section that the sequences mentioned be containers.)
Logically, I think that [lib.sequence.reqmts] should have used
the term "sequence container", rather than just sequence, but
it's probably not worth the effort of changing now (as long as
"sequence" in the algorithm section only appears in the headers
or in very general statements, and not as part of a normative
requirement concerning the algorithm).


(Note too the first sentence of    25: "[...] on containers and
other sequences."  This doesn't make sense if "sequence" here is
given the same meaning as in [lib.sequence.reqmts].)

--
James Kanze


--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: Pete Becker <pete@versatilecoding.com>
Date: Mon, 16 Nov 2009 16:52:15 CST
Raw View
James Kanze wrote:


    It's a bit misfortunate in that the standard does define
    "sequence" elsewhere [lib.sequence.reqmts], with a definition
    which is really irrelevant here.  ("A sequence is a kind of a
    container", where as there's absolutely no requirement in the
    algorithms section that the sequences mentioned be containers.)
    Logically, I think that [lib.sequence.reqmts] should have used
    the term "sequence container", rather than just sequence,


That's already been done for C++0x.

--
 Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of
"The Standard C++ Library Extensions: a Tutorial and Reference"
(www.petebecker.com/tr1book)

[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: James Kanze <james.kanze@gmail.com>
Date: Tue, 10 Nov 2009 14:20:51 CST
Raw View
On Nov 9, 6:27 pm, "subramanian10...@yahoo.com, India"
<subramanian10...@yahoo.com> wrote:
> In the ISO/IEC-14882:2003 document, the clause -
> '25 Algorithms library' contains
> 25.1 Non-modifying sequence operations
> 25.2 Mutating sequence operations
> 25.3 sorting and related operations
> 25.4 C library algorithms

> Here the first two sub-clauses namely 25.1 and 25.2 mention
> "sequence" operations. My question is why these two sets of
> algorithms are named as "sequence" operations ? What does the
> name 'sequence' here mean ?  Since all the algorithms work on
> iterator ranges and they do not know anything about the
> underlying container type, the word 'sequence' in 25.1 and
> 25.2 cannot refer to sequence containers as the underlying
> data structures.

A pair of iterators defines a sequence.  Functions which take a
pair of iterators are functions which operate on a sequence.

--
James Kanze

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: "subramanian100in@yahoo.com, India" <subramanian100in@yahoo.com>
Date: Fri, 13 Nov 2009 11:57:07 CST
Raw View
*) On Nov 11, 1:20 am, James Kanze <james.ka...@gmail.com> wrote:
> On Nov 9, 6:27 pm, "subramanian10...@yahoo.com, India"
>
> <subramanian10...@yahoo.com> wrote:
> > In the ISO/IEC-14882:2003 document, the clause -
> > '25 Algorithms library' contains
> > 25.1 Non-modifying sequence operations
> > 25.2 Mutating sequence operations
> > 25.3 sorting and related operations
> > 25.4 C library algorithms
> > Here the first two sub-clauses namely 25.1 and 25.2 mention
> > "sequence" operations. My question is why these two sets of
> > algorithms are named as "sequence" operations ? What does the
> > name 'sequence' here mean ?  Since all the algorithms work on
> > iterator ranges and they do not know anything about the
> > underlying container type, the word 'sequence' in 25.1 and
> > 25.2 cannot refer to sequence containers as the underlying
> > data structures.
>
> A pair of iterators defines a sequence.  Functions which take a
> pair of iterators are functions which operate on a sequence.
>
> --
> James Kanze
>
> --

So a sequence is an alternative terminology for iterator range. Am I
correct ?

Kindly clarify.

Thanks
V.Subramanian

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: "Bo Persson" <bop@gmb.dk>
Date: Fri, 13 Nov 2009 14:14:43 CST
Raw View
subramanian100in@yahoo.com wrote:
> *) On Nov 11, 1:20 am, James Kanze <james.ka...@gmail.com> wrote:
>> On Nov 9, 6:27 pm, "subramanian10...@yahoo.com, India"
>>
>> <subramanian10...@yahoo.com> wrote:
>>> In the ISO/IEC-14882:2003 document, the clause -
>>> '25 Algorithms library' contains
>>> 25.1 Non-modifying sequence operations
>>> 25.2 Mutating sequence operations
>>> 25.3 sorting and related operations
>>> 25.4 C library algorithms
>>> Here the first two sub-clauses namely 25.1 and 25.2 mention
>>> "sequence" operations. My question is why these two sets of
>>> algorithms are named as "sequence" operations ? What does the
>>> name 'sequence' here mean ?  Since all the algorithms work on
>>> iterator ranges and they do not know anything about the
>>> underlying container type, the word 'sequence' in 25.1 and
>>> 25.2 cannot refer to sequence containers as the underlying
>>> data structures.
>>
>> A pair of iterators defines a sequence.  Functions which take a
>> pair of iterators are functions which operate on a sequence.
>>
>
> So a sequence is an alternative terminology for iterator range. Am I
> correct ?
>
> Kindly clarify.
>

Not really.  :-)

A pair of iterators might define the beginning and end of a sequence.
It could also be a container or a stream. A string literal can be seen
as a sequence of characters.


Bo Persson





--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: Greg Herlihy <greghe@mac.com>
Date: Fri, 13 Nov 2009 16:47:09 CST
Raw View
On Nov 13, 12:57 pm, "subramanian10...@yahoo.com, India"
<subramanian10...@yahoo.com> wrote:
>
> So a sequence is an alternative terminology for iterator range. Am I
> correct ?

The official ISO definition of a sequence is "An ordered list of zero
or more items."
[ISO 14977/3.1]

Greg


--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: "subramanian100in@yahoo.com, India" <subramanian100in@yahoo.com>
Date: Mon, 9 Nov 2009 12:27:04 CST
Raw View
In the ISO/IEC-14882:2003 document, the clause -
'25 Algorithms library' contains
25.1 Non-modifying sequence operations
25.2 Mutating sequence operations
25.3 sorting and related operations
25.4 C library algorithms

Here the first two sub-clauses namely 25.1 and 25.2 mention "sequence"
operations. My question is why these two sets of algorithms are named
as "sequence" operations ? What does the name 'sequence' here mean ?
Since all the algorithms work on iterator ranges and they do not know
anything about the underlying container type, the word 'sequence' in
25.1 and 25.2 cannot refer to sequence containers as the underlying
data structures.

Kindly explain the reason.

Thanks
V.Subramanian

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use
mailto:std-c++@netlab.cs.rpi.edu<std-c%2B%2B@netlab.cs.rpi.edu>
]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]