Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #278

Re: std:: istreambuf_iterator does not meet the requirements for an iterator

From Daniel Krügler<daniel.kruegler@googlemail.com>
Newsgroups comp.std.c++
Subject Re: std:: istreambuf_iterator does not meet the requirements for an iterator
Date 2011-09-07 11:03 -0700
Organization A noiseless patient Spider
Message-ID <j48a3k$s6d$1@dont-email.me> (permalink)
References <j47va5$1alu$1@news2.ipartners.pl>

Show all headers | View raw


Am 07.09.2011 18:54, schrieb Krzysztof Żelechowski:
>  As of N3242, for an input iterator (i), the type of (*i) must be a reference
>  ([iterator.iterators], Table 106).  However, if (i) is an instance of std::
>  istreambuf_iterator<   char>, the type of (*i) is char, which is not a
>  reference.  Inconsistent?

No, you are misinterpreting Table 106. Table 106 just requires that the
result type of the expression *r shall be equal to reference (in code
font) and [iterator.requirements.general] p11 says:

"In the following sections, a and b denote values of type X or const X,
difference_type and reference refer to the types
iterator_traits<X>::difference_type and iterator_traits<X>::reference,
respectively, [..]"

So, the wording does not require that the result of an input iterator
must be a real reference type, it must only match that of the typename
reference. Note also, that Table 107, which *refines* Table 106, is more
specific in regard to the expression *a:

"*a convertible to T"

Further, [istreambuf.iterator] has fixed the former definition of the
typedef pointer to /unspecified/ and the typedef reference is still
charT as in C++03, which is now a conforming implementation in regard to
the input iterator requirements.

>  (As a practical manifestation, this is the reason why boost:: zip_iterator
>  does not work with std:: istreambuf_iterator).

This cannot be the reason.

HTH&  Greetings from Bremen,

- Daniel Krügler


-- 
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

std:: istreambuf_iterator does not meet the requirements for an iterator Krzysztof Żelechowski <giecrilj@stegny.2a.pl> - 2011-09-07 09:54 -0700
  Re: std:: istreambuf_iterator does not meet the requirements for an   iterator Marc<marc.glisse@gmail.com> - 2011-09-07 11:03 -0700
  Re: std:: istreambuf_iterator does not meet the requirements for an iterator Daniel Krügler<daniel.kruegler@googlemail.com> - 2011-09-07 11:03 -0700
  Re: std:: istreambuf_iterator does not meet the requirements for an  iterator Marc <marc.glisse@gmail.com> - 2011-09-08 14:47 -0700

csiph-web