
"Eric Niebler" <eric@boost-consulting.com> wrote in message news:428926DB.2090108@boost-consulting.com... | | Thorsten Ottosen wrote: | > "Eric Niebler" <eric@boost-consulting.com> wrote in message | > | vector<bool> creates all kinds of problems because generic code can't | > | make assumptions about the behavior of vector<T>. vector<bool> is widely | > | regarded as a Bad Move. Dave is saying that treating char[] different | > | than, say, int[] is inviting the same sorts of problems. It will make it | > | difficult to deal with T[] in generic code. | > | | > | I agree with Dave. | > | > are these "problems" as serious as vector<bool> ? | > | | | Yes. It's exactly the same situation. You are giving collection<X> | different semantics than collection<Y>. I guess my objection is to the use "exactly". If I have template< class T > class my_vec { std::vector<T> vec; }; then I might need some traits for dealing with the bool case. If I have template< class Range, class OutIter > void copy( const Range&, OutIter ); then I just need to be able to say what a Range means. I think it would be wrong for the algorithm to assume anything; that would not give the caller a chance to decide. And that is why Pavol said, let's allow copy( as_array( rng ), out ); copy( as_string( rng ), out ); copy( rng, out ); If we don't wan't to give string literals a special meaning in the range library, then we up with the rather clumsy sub_range<string> r = find( rng, as_string( "foo" ) ); compared to sub_range<string> r = find( rng, "foo" ); It is not obvious why you ever want to include the 0 in a literal, but if you want, there should be a way to do so. Currently the isn't any support in the range lib, but there should be. | BTW, I find your use of quotes rather "disparaging". If you think this | situation is different, please give /technical/ reasons. Thanks. Yeah, sorry. I guess I was equally annoyed by the claim that we had a new problem simply by stating vector<bool> was a problem. I don't see that close an analogy and so the argument made by Dave could be used to to argue for anything. I don't think the decisions of the range library was a big issue during the review; Peter Dimov was, I think, one who said something along your opinion. Anyway, it wasn't (and isn't) obvious to me that having special cases in the range library is a bad idea--- as long as you can still explicitly ask for the other generic version. br -Thorsten