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