This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

iter_swapping vector<bool>::iterator..


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've just wandered across a problem in iter_swap.. that if you
specialise iter_swap to use swap, then you can't iter_swap
vector<bool>::iterators any more ¬_¬

There are I believe 4 solutions to this:

1) Go back to old behaviour - iter_swap does delegate to swap
2) Accept that iter_swap doesn't work on vector<bool>::iterator
3) Overload iter_swap for vector<bool>::iterator
4) Do some kind of clever template thing which detects temporaries and
calls a different function depending on the type.

I've been taking a stab at (4), and have been able to figure out if
something is temporary or not by checking if it matches "const T&" or
"T&" (after first checking if it is const). I've been having trouble
figuring out how to "capture" this information so that I can use it in
templates however... Any suggestions from template experts?

Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCOugE3FpDzErifpIRAnruAJsHRHHOOy08wKpYqbA7POT8w8C6JQCfSI3E
Jj+2i+EQ4wf+2i00zQGBc6c=
=XvXI
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]