|
From: Jonathan W. <co...@co...> - 2003-02-06 18:43:38
|
On Thu, Feb 06, 2003 at 12:31:01PM -0500, Stefan Seefeld wrote:
> >I see that you have tried to avoid this by using method names such as
> >children_begin() instead of begin() but then I think it's less
> >STL-container-like.
>
> well, it's enough to be used as an STL container:
>
> template <typename iterator>
> void my_function(iterator begin, iterator end)
> {
> // do something with the content here...
> }
>
> Element *element = ...;
> my_function(element->children_begin(), element->children_end());
>
> which is rather elegant and intuitive (and consistent with STL),
> don't you think ?
No. It is not consistent with the STL. The STL clearly defines names for
required methods, so it should be begin() not children_begin().
If the interface conforms to one of the STL concepts then the names
should match to indicate as much. A STL-savvy user who reads something
saying "The libxml++ Document is a model of an STL Forward Container"
will asusme they can write code using the "begin()" method.
jon
--
"Subvert the dominant paradigm!"
- The I.O.D.
|