stl_iterator_base_funcs.h: Minor formatting and indentation tweaks.

2004-02-03  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/stl_iterator_base_funcs.h: Minor formatting
	and indentation tweaks.
	* include/bits/stl_iterator_base_types.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/stl_tempbuf.h: Likewise.

From-SVN: r77182
This commit is contained in:
Paolo Carlini 2004-02-03 17:59:05 +00:00 committed by Paolo Carlini
parent e621b5885a
commit 83042fcaec
6 changed files with 52 additions and 28 deletions

View File

@ -1,3 +1,12 @@
2004-02-03 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_iterator_base_funcs.h: Minor formatting
and indentation tweaks.
* include/bits/stl_iterator_base_types.h: Likewise.
* include/bits/stl_list.h: Likewise.
* include/bits/stl_map.h: Likewise.
* include/bits/stl_tempbuf.h: Likewise.
2004-02-02 Jerry Quinn <jlquinn@optonline.net> 2004-02-02 Jerry Quinn <jlquinn@optonline.net>
* include/bits/gslice.h, include/bits/gslice_array.h, * include/bits/gslice.h, include/bits/gslice_array.h,

View File

@ -137,9 +137,11 @@ namespace std
__glibcxx_function_requires(_BidirectionalIteratorConcept< __glibcxx_function_requires(_BidirectionalIteratorConcept<
_BidirectionalIterator>) _BidirectionalIterator>)
if (__n > 0) if (__n > 0)
while (__n--) ++__i; while (__n--)
++__i;
else else
while (__n++) --__i; while (__n++)
--__i;
} }
template<typename _RandomAccessIterator, typename _Distance> template<typename _RandomAccessIterator, typename _Distance>

View File

@ -124,7 +124,8 @@ namespace std
* provide tighter, more correct semantics. * provide tighter, more correct semantics.
*/ */
template<typename _Iterator> template<typename _Iterator>
struct iterator_traits { struct iterator_traits
{
typedef typename _Iterator::iterator_category iterator_category; typedef typename _Iterator::iterator_category iterator_category;
typedef typename _Iterator::value_type value_type; typedef typename _Iterator::value_type value_type;
typedef typename _Iterator::difference_type difference_type; typedef typename _Iterator::difference_type difference_type;
@ -133,7 +134,8 @@ namespace std
}; };
template<typename _Tp> template<typename _Tp>
struct iterator_traits<_Tp*> { struct iterator_traits<_Tp*>
{
typedef random_access_iterator_tag iterator_category; typedef random_access_iterator_tag iterator_category;
typedef _Tp value_type; typedef _Tp value_type;
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
@ -142,7 +144,8 @@ namespace std
}; };
template<typename _Tp> template<typename _Tp>
struct iterator_traits<const _Tp*> { struct iterator_traits<const _Tp*>
{
typedef random_access_iterator_tag iterator_category; typedef random_access_iterator_tag iterator_category;
typedef _Tp value_type; typedef _Tp value_type;
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;

View File

@ -76,15 +76,21 @@ namespace __gnu_norm
_List_node_base* _M_next; ///< Self-explanatory _List_node_base* _M_next; ///< Self-explanatory
_List_node_base* _M_prev; ///< Self-explanatory _List_node_base* _M_prev; ///< Self-explanatory
static void swap(_List_node_base& __x, static void
_List_node_base& __y); swap(_List_node_base& __x, _List_node_base& __y);
void transfer(_List_node_base * const __first, void
_List_node_base * const __last); transfer(_List_node_base * const __first,
_List_node_base * const __last);
void reverse(); void
void hook(_List_node_base * const __position); reverse();
void unhook();
void
hook(_List_node_base * const __position);
void
unhook();
}; };
/// @if maint An actual node in the %list. @endif /// @if maint An actual node in the %list. @endif
@ -286,6 +292,7 @@ namespace __gnu_norm
// allocator_type and _Node_Alloc_type. The conversion is // allocator_type and _Node_Alloc_type. The conversion is
// required by table 32 in [20.1.5]. // required by table 32 in [20.1.5].
typedef typename _Alloc::template rebind<_List_node<_Tp> >::other typedef typename _Alloc::template rebind<_List_node<_Tp> >::other
_Node_Alloc_type; _Node_Alloc_type;
_List_node_base _M_node; _List_node_base _M_node;

View File

@ -336,7 +336,7 @@ namespace __gnu_norm
iterator __i = lower_bound(__k); iterator __i = lower_bound(__k);
// __i->first is greater than or equivalent to __k. // __i->first is greater than or equivalent to __k.
if (__i == end() || key_comp()(__k, (*__i).first)) if (__i == end() || key_comp()(__k, (*__i).first))
__i = insert(__i, value_type(__k, mapped_type())); __i = insert(__i, value_type(__k, mapped_type()));
return (*__i).second; return (*__i).second;
} }

View File

@ -132,7 +132,9 @@ namespace std
private: private:
// Disable copy constructor and assignment operator. // Disable copy constructor and assignment operator.
_Temporary_buffer(const _Temporary_buffer&); _Temporary_buffer(const _Temporary_buffer&);
void operator=(const _Temporary_buffer&);
void
operator=(const _Temporary_buffer&);
}; };
@ -140,27 +142,28 @@ namespace std
_Temporary_buffer<_ForwardIterator, _Tp>:: _Temporary_buffer<_ForwardIterator, _Tp>::
_Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
: _M_original_len(std::distance(__first, __last)), : _M_original_len(std::distance(__first, __last)),
_M_len(0) , _M_buffer(0) _M_len(0), _M_buffer(0)
{ {
// Workaround for a __type_traits bug in the pre-7.3 compiler. // Workaround for a __type_traits bug in the pre-7.3 compiler.
typedef typename __type_traits<_Tp>::has_trivial_default_constructor typedef typename __type_traits<_Tp>::has_trivial_default_constructor
_Trivial; _Trivial;
try try
{ {
pair<pointer, size_type> __p(get_temporary_buffer<value_type>(_M_original_len)); pair<pointer, size_type> __p(get_temporary_buffer<
_M_buffer = __p.first; value_type>(_M_original_len));
_M_len = __p.second; _M_buffer = __p.first;
if (_M_len > 0) _M_len = __p.second;
_M_initialize_buffer(*__first, _Trivial()); if (_M_len > 0)
} _M_initialize_buffer(*__first, _Trivial());
}
catch(...) catch(...)
{ {
std::return_temporary_buffer(_M_buffer); std::return_temporary_buffer(_M_buffer);
_M_buffer = 0; _M_buffer = 0;
_M_len = 0; _M_len = 0;
__throw_exception_again; __throw_exception_again;
} }
} }
} // namespace std } // namespace std