Re: boost::shared_ptr<T> and Gtk::TreeModelColumn<T>
- From: Edd Dawson <edd nunswithguns net>
- To: gtkmm-list gnome org
- Subject: Re: boost::shared_ptr<T> and Gtk::TreeModelColumn<T>
- Date: Mon, 18 Sep 2006 21:51:38 +0100
Paul Davis wrote:
any opinions on the best way to have:
Gtk::TreeModelColumn<boost::shared_ptr<T> >
at the moment, g++ appears to pick the void* partial specialization of
TreeModelColumn, which leads to problems later (glib complains that the
object is not actually a G_TYPE_POINTER etc). i have considered
implementing another partial specialization, but I am not sure it will
solve the issue. any thoughts?
Perhaps:
// uncompiled/untested
template<typename T>
class thin_ptr_wrapper
{
public:
typedef boost::shared_ptr<T> ptr_type;
typedef boost::shared_ptr<const T> const_ptr_type;
thin_ptr_wrapper(const ptr_type &p) : p_(p) { }
ptr_type &operator->() { return p_; }
const_ptr_type &operator->() const { return p_; }
// etc...
private:
ptr_type p_;
};
And then use a Gtk::TreeModelColumn<thin_ptr_wrapper<T> > instead?
I'm sure there's probably a better solution, though.
I'm not sure why the void* specialization is used, though. AFAIK
boost::shared_ptr only has a conversion operator to an 'unspecified boolean
type', which I believe is commonly implemented as a pointer-to-member-function.
Edd
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]