Re: creating a vector of a vector of Gtk::ToggleButton
- From: Chris Vine <chris cvine freeserve co uk>
- To: Carl Nygard <cjnygard fast net>
- Cc: Paul Davis <paul linuxaudiosystems com>, gtkmm-list gnome org
- Subject: Re: creating a vector of a vector of Gtk::ToggleButton
- Date: Sat, 30 Oct 2004 18:53:28 +0100
On Saturday 30 October 2004 16:05, Carl Nygard wrote:
> > It might be useful to add a pure scoped pointer, one which does not clone
> > a referenced object (even if the referenced object is cloneable) and
> > which once initialised does not allow the identity of its referenced
> > object to be changed. (Although I realise that a const std::autoptr will
> > do most of this for you.)
>
> patches accepted;) If I get frisky I might attempt it. My purpose for
> this was pure maintainership, because Kevin was no longer making it
> available.
It would probably require an extra option "flag" which would break existing
code using it, but I will have a think about it. Actually something like
this will really come into its own when templated typedefs are in the
standard, so you can do something like this:
template <class T> typedef ksvh::smart_ptr<T>::sbnwm shared_ptr<T>;
As it is, to provide this kind of convenience type you have to derive an
entire new wrapper, viz:
template <class T>
struct shared_ptr: public ksvh::smart_ptr<T>::sbnwm {
shared_ptr(T* p): ksvh::smart_ptr<T>::sbnwm(p) {}
shared_ptr(const Shared_ptr& s): ksvh::smart_ptr<T>::sbnwm(s) {}
shared_ptr() {}
template <class U> shared_ptr(const shared_ptr<U>& s):
ksvh::smart_ptr<T>::sbnwm(s) {}
template <class U> shared_ptr& operator=(const shared_ptr<U>& s) {
return operator=(shared_ptr(s));
}
};
An option of locking the reference count would also be nice, for thread safety
purposes, but that would then make it dependent on a particular
locking/threading library and/or particular processor instructions for
individual platforms.
> > However I notice that you release it under the GPL whereas Kevin Horn
> > released it as public domain. To make the library more useful it would
> > be a good idea to indicate what the new code is (if any) which is
> > GPL-only.
>
> What makes you think that? The actual smartptr source file only shows
> Kevin's original public domain license.
>
> Personally, I'd prefer LGPL for this, and I don't really want to get
> into which-piece-is-which-license for this library. But I have to
> respect Kevin's wishes, and he placed it in public domain, so I'll cross
> that bridge when I get to it.
I don't think the LGPL works with this kind of templated library. You would
probably need to employ the modified GPL under which libstdc++ is distributed
in g++ (this allows users to incorporate it, including headers, in users'
code without GPLing the users' code).
Chris.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]