Fwd: Re: [Patch] Remove workaround for copy_backward

Douglas Gregor gregod@cs.rpi.edu
Sun Sep 28 22:46:00 GMT 2003


On Sunday 28 September 2003 03:32 pm, Gabriel Dos Reis wrote:
>   (3) breaks conforming codes (even if we may disagree on their being
>       good practice)
>
>      I'd take my favorite example, page 9 from
> http://www.cmla.ens-cachan.fr/~dosreis/C++/talks/generic-programming-in-cxx
>.pdf
>
>      #include <vector>
>      struct X {
>         explicit X(int) { }
>      };
>
>      int main()
>      {
>         std::vector<X> w(25, 4);                // OK
>      }
>
>     With enable-if work-around as proposed, the above will be
>     (incorrectly) rejected. If you think it is contrived example (and
>     I conceide the point), think
>
>       std::vector<std::vector<int> > matrix(3, 3);
>
>     I've already seen codes like that.
>
> -- Gaby

This is the killer argument, then, against using the enable-if workaround. I 
suppose (but can't confirm) that the fact that the above works was an 
unintended consequence of the use of static_cast<> in the specification. Have 
you submitted a DR on this? If not, should someone do so?

	Doug



More information about the Libstdc++ mailing list