Commit b581eaf7 by Benjamin Kosnik Committed by Benjamin Kosnik

std_iterator.h: Include sbuf_iter.h via std_ios.h.


2001-06-26  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/std_iterator.h: Include sbuf_iter.h via std_ios.h.

	* include/bits/stl_iterator.h (istream_iterator): Inherit from
	iterator.
	(ostream_iterator): Same.
	* testsuite/24_iterators/istream_iterator.cc: New file.
	* testsuite/24_iterators/ostream_iterator.cc: New file.

	* include/bits/sbuf_iter.h: Remove self typedef.
	* testsuite/24_iterators/ostreambuf_iterator.cc: Add test.
	* testsuite/24_iterators/istreambuf_iterator.cc: Add test.

	* include/bits/stl_iterator.h (reverse_iterator): Remove
	extraneous typedefs. Add typename.
	(__normal_iterator): Remove typedefs referring to self. Add typename.
	(reverse_bidiretional_iterator): Remove, not longer required.

From-SVN: r43570
parent b2b263e1
2001-06-26 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/std_iterator.h: Include sbuf_iter.h via std_ios.h.
* include/bits/stl_iterator.h (istream_iterator): Inherit from
iterator.
(ostream_iterator): Same.
* testsuite/24_iterators/istream_iterator.cc: New file.
* testsuite/24_iterators/ostream_iterator.cc: New file.
* include/bits/sbuf_iter.h: Remove self typedef.
* testsuite/24_iterators/ostreambuf_iterator.cc: Add test.
* testsuite/24_iterators/istreambuf_iterator.cc: Add test.
* include/bits/stl_iterator.h (reverse_iterator): Remove
extraneous typedefs. Add typename.
(__normal_iterator): Remove typedefs referring to self. Add typename.
(reverse_bidiretional_iterator): Remove, not longer required.
2001-06-26 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
* include/bits/stl_iterator.h (__normal_iterator<>): Qualify
......
......@@ -103,8 +103,6 @@ namespace std
typedef typename _Traits::int_type int_type;
typedef basic_streambuf<_CharT, _Traits> streambuf_type;
typedef basic_istream<_CharT, _Traits> istream_type;
// Non-standard Types:
typedef istreambuf_iterator<_CharT, _Traits> __istreambufiter_type;
private:
// 24.5.3 istreambuf_iterator
......@@ -144,7 +142,7 @@ namespace std
return __ret;
}
__istreambufiter_type&
istreambuf_iterator&
operator++()
{
if (_M_sbuf)
......@@ -153,10 +151,10 @@ namespace std
return *this;
}
__istreambufiter_type
istreambuf_iterator
operator++(int)
{
__istreambufiter_type __old = *this;
istreambuf_iterator __old = *this;
if (_M_sbuf)
__old._M_c = _M_sbuf->sbumpc();
_M_c = -2;
......@@ -164,7 +162,7 @@ namespace std
}
bool
equal(const __istreambufiter_type& __b)
equal(const istreambuf_iterator& __b)
{
int_type __eof = traits_type::eof();
bool __thiseof = !_M_sbuf || _M_sbuf->sgetc() == __eof;
......@@ -177,7 +175,7 @@ namespace std
// 110 istreambuf_iterator::equal not const
// NB: there is also number 111 pending on this function.
bool
equal(const __istreambufiter_type& __b) const
equal(const istreambuf_iterator& __b) const
{
int_type __eof = traits_type::eof();
bool __thiseof = !_M_sbuf || _M_sbuf->sgetc() == __eof;
......
// 2001-06-25 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 24.5.1 Template class istream_iterator
#include <iterator>
void test01()
{
using namespace std;
// Check for required base class.
typedef istream_iterator<long> test_iterator;
typedef iterator<input_iterator_tag, long, ptrdiff_t, const long*,
const long&> base_iterator;
test_iterator r_it;
base_iterator* base = &r_it;
// Check for required typedefs
typedef test_iterator::value_type value_type;
typedef test_iterator::difference_type difference_type;
typedef test_iterator::pointer pointer;
typedef test_iterator::reference reference;
typedef test_iterator::iterator_category iteratory_category;
typedef test_iterator::char_type char_type;
typedef test_iterator::traits_type traits_type;
typedef test_iterator::istream_type istream_type;
}
int main()
{
test01();
return 0;
}
......@@ -24,7 +24,33 @@
#include <iterator>
#include <debug_assert.h>
bool test01(void)
void test01()
{
using namespace std;
// Check for required base class.
typedef istreambuf_iterator<char> test_iterator;
typedef char_traits<char>::off_type off_type;
typedef iterator<input_iterator_tag, char, off_type, char*, char&> base_iterator;
istringstream isstream("this tag");
test_iterator r_it(isstream);
base_iterator* base = &r_it;
// Check for required typedefs
typedef test_iterator::value_type value_type;
typedef test_iterator::difference_type difference_type;
typedef test_iterator::pointer pointer;
typedef test_iterator::reference reference;
typedef test_iterator::iterator_category iteratory_category;
typedef test_iterator::char_type char_type;
typedef test_iterator::traits_type traits_type;
typedef test_iterator::istream_type istream_type;
typedef test_iterator::streambuf_type streambuf_type;
}
bool test02(void)
{
typedef std::istreambuf_iterator<char> cistreambuf_iter;
......@@ -116,7 +142,7 @@ bool test01(void)
}
// libstdc++/2627
void test02()
void test03()
{
bool test = true;
const std::string s("free the vieques");
......@@ -155,6 +181,6 @@ int main()
{
test01();
test02();
test03();
return 0;
}
// 2001-06-25 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 24.5.4 Template class ostream_iterator
#include <iterator>
#include <ostream>
#include <sstream>
void test01()
{
using namespace std;
// Check for required base class.
typedef ostream_iterator<long> test_iterator;
typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
ostringstream osstream("this tag");
test_iterator r_it(osstream);
base_iterator* base = &r_it;
// Check for required typedefs
typedef test_iterator::value_type value_type;
typedef test_iterator::difference_type difference_type;
typedef test_iterator::pointer pointer;
typedef test_iterator::reference reference;
typedef test_iterator::iterator_category iteratory_category;
typedef test_iterator::char_type char_type;
typedef test_iterator::traits_type traits_type;
typedef test_iterator::ostream_type ostream_type;
}
int main()
{
test01();
return 0;
}
......@@ -24,7 +24,31 @@
#include <iterator>
#include <debug_assert.h>
bool test01(void)
void test01()
{
using namespace std;
// Check for required base class.
typedef ostreambuf_iterator<char> test_iterator;
typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
ostringstream osstream("this tag");
test_iterator r_it(osstream);
base_iterator* base = &r_it;
// Check for required typedefs
typedef test_iterator::value_type value_type;
typedef test_iterator::difference_type difference_type;
typedef test_iterator::pointer pointer;
typedef test_iterator::reference reference;
typedef test_iterator::iterator_category iteratory_category;
typedef test_iterator::char_type char_type;
typedef test_iterator::traits_type traits_type;
typedef test_iterator::ostream_type ostream_type;
typedef test_iterator::streambuf_type streambuf_type;
}
bool test02(void)
{
typedef std::ostreambuf_iterator<char> costreambuf_iter;
typedef costreambuf_iter::streambuf_type cstreambuf_type;
......@@ -93,6 +117,7 @@ bool test01(void)
int main()
{
test01();
test02();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment