stl_algo.h (swap_ranges): Move...

2007-03-12  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/stl_algo.h (swap_ranges): Move...
	* include/bits/stl_algobase.h: ... here.
	* include/tr1/array: Trim includes, stl_algobase.h is enough.

From-SVN: r122840
This commit is contained in:
Paolo Carlini 2007-03-12 13:59:50 +00:00 committed by Paolo Carlini
parent d8e3118a8b
commit 91b0b94a04
4 changed files with 42 additions and 41 deletions

View File

@ -1,3 +1,9 @@
2007-03-12 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_algo.h (swap_ranges): Move...
* include/bits/stl_algobase.h: ... here.
* include/tr1/array: Trim includes, stl_algobase.h is enough.
2007-03-11 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28080 (final)

View File

@ -860,40 +860,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
std::__iterator_category(__first));
}
/**
* @brief Swap the elements of two sequences.
* @param first1 A forward iterator.
* @param last1 A forward iterator.
* @param first2 A forward iterator.
* @return An iterator equal to @p first2+(last1-first1).
*
* Swaps each element in the range @p [first1,last1) with the
* corresponding element in the range @p [first2,(last1-first1)).
* The ranges must not overlap.
*/
template<typename _ForwardIterator1, typename _ForwardIterator2>
_ForwardIterator2
swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2)
{
// concept requirements
__glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
_ForwardIterator1>)
__glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
_ForwardIterator2>)
__glibcxx_function_requires(_ConvertibleConcept<
typename iterator_traits<_ForwardIterator1>::value_type,
typename iterator_traits<_ForwardIterator2>::value_type>)
__glibcxx_function_requires(_ConvertibleConcept<
typename iterator_traits<_ForwardIterator2>::value_type,
typename iterator_traits<_ForwardIterator1>::value_type>)
__glibcxx_requires_valid_range(__first1, __last1);
for ( ; __first1 != __last1; ++__first1, ++__first2)
std::iter_swap(__first1, __first2);
return __first2;
}
/**
* @brief Perform an operation on a sequence.
* @param first An input iterator.

View File

@ -167,6 +167,40 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
iter_swap(__a, __b);
}
/**
* @brief Swap the elements of two sequences.
* @param first1 A forward iterator.
* @param last1 A forward iterator.
* @param first2 A forward iterator.
* @return An iterator equal to @p first2+(last1-first1).
*
* Swaps each element in the range @p [first1,last1) with the
* corresponding element in the range @p [first2,(last1-first1)).
* The ranges must not overlap.
*/
template<typename _ForwardIterator1, typename _ForwardIterator2>
_ForwardIterator2
swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2)
{
// concept requirements
__glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
_ForwardIterator1>)
__glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
_ForwardIterator2>)
__glibcxx_function_requires(_ConvertibleConcept<
typename iterator_traits<_ForwardIterator1>::value_type,
typename iterator_traits<_ForwardIterator2>::value_type>)
__glibcxx_function_requires(_ConvertibleConcept<
typename iterator_traits<_ForwardIterator2>::value_type,
typename iterator_traits<_ForwardIterator1>::value_type>)
__glibcxx_requires_valid_range(__first1, __last1);
for (; __first1 != __last1; ++__first1, ++__first2)
std::iter_swap(__first1, __first2);
return __first2;
}
/**
* @brief This does what you think it does.
* @param a A thing of arbitrary type.

View File

@ -1,6 +1,6 @@
// class template array -*- C++ -*-
// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
// Copyright (C) 2004, 2005, 2006, 2007 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
@ -34,12 +34,7 @@
#ifndef _TR1_ARRAY
#define _TR1_ARRAY 1
#include <new>
#include <iterator>
#include <algorithm>
#include <cstddef>
#include <bits/functexcept.h>
#include <ext/type_traits.h>
#include <bits/stl_algobase.h>
//namespace std::tr1
namespace std