Re: Move from {Array,List,Slist}Handle to std::vector.



On Tue, 2011-01-18 at 23:10 +0100, Krzesimir Nowak wrote:
> Hi,
> 
> I pushed to Glibmm repository my own branch called `vector'

Thanks.

Here's a link for others:
http://git.gnome.org/browse/glibmm/log/?h=vector

> The downside of current API is that methods using
> {Array,List,SList}Handle could take both C++ containers and C arrays as
> a parameter. Now methods can take only std::vector,
[snip]

I think that's acceptable.

> But I still have some doubts. Some intro first:
> Most common functions are the ones returning a container and the ones
> taking container as a parameter. A function can have three types of
> ownership transfer: deep, shallow and none. So in the end there are six
> types:
> 1. function returning a container with full ownership transfer - that
> means that caller owns both container and data it holds.
> 2. function returning a container with shallow ownership transfer- that
> means that caller owns only container, data belongs to the function.
> 3. function returning a container with no ownership transfer - that
> means that caller owns nothing.
> 4. function taking a container as a parameter with full ownership
> transfer - that means that function takes ownership of both container
> and data.
> 5. function taking a container as a parameter with shallow ownership
> transfer - that means that function takes ownership of data only,
> container still belongs to caller.
> 6. function taking a container as a parameter with no ownership transfer
> - that means that function takes no ownership, both container and data
> still belongs to caller.

In practice, we have only needed 3 varieties so far: OWNERSHIP_NONE,
OWNERSHIP_SHALLOW, and OWNERSHIP_DEEP.

Why do you need more now? That seems to be making your task harder for
no actual gain.

> There are also functions that take parameter, but treat it as a return
> value - these are best wrapped by hand and are not covered here.

You mean output parameters, I think. Yes, let's ignore that for now.

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]