Re: request: std::vector with typed indices
ben.craig@gmail.com wrote:
Ahh, I had forgotten that the overloaded operator[] would hide the base
class's operator[], so it does indeed prevent unwanted size_t
parameters. However, I stand by my original recommendation.
vector_typed_index no longer models Liskov IS-A or WORKS-LIKE-A (Herb
Sutter's Exceptional C++: Item 22 discusses this issue).
Which only means that you might not be able to use vector_typed where
you can use vector. So don't do that. Template code rarely follows
guidelines developed for inheritance and virtual functions. On the other
hand, if you've written, for example, a template function that takes a
vector and displays its contents in some fancy format, you probably do
what to be able to use it, unchanged, with vector_typed.
--
-- Pete
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." For more information about this book, see
www.petebecker.com/tr1book.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]