Re: [gtkmm] gtkmm3 speculation: intermediate types.
- From: Daniel Elstner <daniel elstner gmx net>
- To: murrayc usa net
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [gtkmm] gtkmm3 speculation: intermediate types.
- Date: 04 Nov 2002 13:28:43 +0100
Am Mon, 2002-11-04 um 12.45 schrieb Murray Cumming:
>
> I'm not very comfortable with our use of intermediate types in the API:
> http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch03s05.html
>
> People don't know how to use them unless they read the book or reference
> documentation.
>
> I think their advantage (You can choose whether to use a list, vector,
> or whatever, instead of us choosing for you) doesn't outweigh the
> disadvantage (they make the API less clear, and people might we're
> stupid enough to implement non-standard containers). Please discuss.
Uhm, I don't think it's a good idea to force a certain container type,
even though I agree that newbies often don't get it at the first
glance. Here are some points pro container handles:
1) The handles support more than just containers. E.g. you can pass an
iterator sequence to a method taking a *Handle as argument:
combo.set_popdown_strings(Glib::sequence(foo.begin(), foo.end());
This is the natural STL approach, actually.
2) If we'd force a container type then using a different container would
involve an extra copy. We're talking about *whole* containers here,
thus that has to be considered.
3) For methods that return *Handle it's even worse. The container
handles are called handles because copying them doesn't involve a
container copy. If such a method would return e.g. std::vector<> the
extra copy would be unavoidable.
--Daniel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]