Commit a2fe9203 by François Dumont Committed by Paolo Carlini

stl_algobase.h (struct __iter_base): Add.

2010-01-28  François Dumont  <francois.cppdevs@free.fr>

	* include/bits/stl_algobase.h (struct __iter_base): Add.
	(__niter_base, __miter_base): Adjust, use the latter.

From-SVN: r156335
parent 6684eb28
2010-01-28 François Dumont <francois.cppdevs@free.fr>
* include/bits/stl_algobase.h (struct __iter_base): Add.
(__niter_base, __miter_base): Adjust, use the latter.
2010-01-28 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/21_strings/basic_string/element_access/char/21674.cc:
......
// Core algorithmic facilities -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
......@@ -259,11 +259,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
// If _Iterator is a __normal_iterator return its base (a plain pointer,
// normally) otherwise return it untouched. See copy, fill, ...
template<typename _Iterator,
bool _IsNormal = __is_normal_iterator<_Iterator>::__value>
struct __niter_base
// If _Iterator has a base returns it otherwise _Iterator is returned
// untouched
template<typename _Iterator, bool _HasBase>
struct __iter_base
{
static _Iterator
__b(_Iterator __it)
......@@ -271,30 +270,25 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
};
template<typename _Iterator>
struct __niter_base<_Iterator, true>
struct __iter_base<_Iterator, true>
{
static typename _Iterator::iterator_type
__b(_Iterator __it)
{ return __it.base(); }
};
// Likewise, for move_iterator.
template<typename _Iterator,
bool _IsMove = __is_move_iterator<_Iterator>::__value>
struct __miter_base
{
static _Iterator
__b(_Iterator __it)
{ return __it; }
};
// If _Iterator is a __normal_iterator return its base (a plain pointer,
// normally) otherwise return it untouched. See copy, fill, ...
template<typename _Iterator>
struct __niter_base
: __iter_base<_Iterator, __is_normal_iterator<_Iterator>::__value>
{ };
// Likewise, for move_iterator.
template<typename _Iterator>
struct __miter_base<_Iterator, true>
{
static typename _Iterator::iterator_type
__b(_Iterator __it)
{ return __it.base(); }
};
struct __miter_base
: __iter_base<_Iterator, __is_move_iterator<_Iterator>::__value>
{ };
// All of these auxiliary structs serve two purposes. (1) Replace
// calls to copy with memmove whenever possible. (Memmove, not memcpy,
......
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