[libxml++] Re: [Libxmlplusplus-general] Adding STL-container-like methods to Node instead of returning a container instance
- From: Jonathan Wakely <cow compsoc man ac uk>
- To: libxmlplusplus-general lists sourceforge net
- Subject: [libxml++] Re: [Libxmlplusplus-general] Adding STL-container-like methods to Node instead of returning a container instance
- Date: Thu, 6 Feb 2003 18:39:33 +0000
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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]