[patch] Unqualified calls to std::copy() in bits/vector.tcc
Jonathan Wakely
cow@compsoc.man.ac.uk
Wed Dec 29 13:51:00 GMT 2004
Oops, sent to patches@gcc not gcc-patches@gcc, sorry.
On Wed, Dec 29, 2004 at 01:01:04PM +0000, Jonathan Wakely wrote:
>
> Our std::vector contains a few unqualified calls to std::copy().
>
> This causes problems for Boost's Meta-Programming Library (where "copy"
> is a functor) due to 3.4's improved ADL (see core DR 218, PR 17365 and
> PR 17045 for related cases).
>
> This isn't technically a regression, since these calls were always
> unqualified until 3.4.0 but qualifications should probably have been
> added to these calls along with all the others. It could be argued that
> since previous versions didn't have correct ADL no conflicts arose, so
> this is a regression.
>
> Tested on i386/FreeBSD. Is this OK for mainline? and 3.4?
>
> 2004-12-29 Jonathan Wakely <redi@gcc.gnu.org>
>
> include/bits/vector.tcc: Qualify all calls to std::copy().
>
> I'm going on holiday so won't be able to commit this myself after today.
> If it's approved then someone else might want to commit it sooner.
>
> I think there are also a couple of unqualified calls in rope (lines 188
> and 215) but I won't have time to check that properly before I go away.
>
> jon
>
> --
> "There are basically two types of people. People who accomplish things,
> and people who claim to have accomplished things.
> The first group is less crowded."
> - Mark Twain
> Index: include/bits/vector.tcc
> ===================================================================
> RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/vector.tcc,v
> retrieving revision 1.21
> diff -u -p -b -B -r1.21 vector.tcc
> --- include/bits/vector.tcc 21 Oct 2004 14:53:01 -0000 1.21
> +++ include/bits/vector.tcc 29 Dec 2004 12:59:14 -0000
> @@ -121,7 +121,7 @@ namespace _GLIBCXX_STD
> vector<_Tp, _Alloc>::
> erase(iterator __first, iterator __last)
> {
> - iterator __i(copy(__last, end(), __first));
> + iterator __i(std::copy(__last, end(), __first));
> std::_Destroy(__i, end(), this->get_allocator());
> this->_M_impl._M_finish = this->_M_impl._M_finish - (__last - __first);
> return __first;
> @@ -149,7 +149,7 @@ namespace _GLIBCXX_STD
> }
> else if (size() >= __xlen)
> {
> - iterator __i(copy(__x.begin(), __x.end(), begin()));
> + iterator __i(std::copy(__x.begin(), __x.end(), begin()));
> std::_Destroy(__i, end(), this->get_allocator());
> }
> else
> @@ -226,7 +226,7 @@ namespace _GLIBCXX_STD
> }
> else if (size() >= __len)
> {
> - iterator __new_finish(copy(__first, __last,
> + iterator __new_finish(std::copy(__first, __last,
> this->_M_impl._M_start));
> std::_Destroy(__new_finish, end(), this->get_allocator());
> this->_M_impl._M_finish = __new_finish.base();
More information about the Gcc-patches
mailing list