*&

D

danny van elsen

hello all,

when a function has a '*&' parameter, as in
Gtk::TreeView::get_cursor(Gtk::TreePath&, Gtk::TreeViewColumn*&)

- what could be the reason for designing a function like this?
- how do I use this function? This doesn't work ...

Gtk::TreeModel::path path;
Gtk::TreeViewColumn column;

....
treeview.get_cursor(path, &column);

error: no matching function for call to
`Gtk::TreeView::get_cursor(Gtk::TreePath&, Gtk::TreeViewColumn*)'
note: candidates are:
void Gtk::TreeView::get_cursor(Gtk::TreePath&, Gtk::TreeViewColumn*&)

bye, Danny.
 
R

Rolf Magnus

danny said:
hello all,

when a function has a '*&' parameter, as in
Gtk::TreeView::get_cursor(Gtk::TreePath&, Gtk::TreeViewColumn*&)

- what could be the reason for designing a function like this?

That the function wants a pointer to be passed by reference, so that it can
change the pointer that the caller passed.
- how do I use this function? This doesn't work ...

Gtk::TreeModel::path path;
Gtk::TreeViewColumn column;

...
treeview.get_cursor(path, &column);

This doesn't give an lvalue, i.e the caller can't change the value of
"&column".

Maybe this is what you need:

Gtk::TreeModel::path path;
Gtk::TreeViewColumn* column;

treeview.get_cursor(path, column);

But it depends on what the function expects and what it does with the
parameter. Consult the documentation of that function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,204
Messages
2,571,064
Members
47,672
Latest member
svaraho

Latest Threads

Top