* Cem Eliguzel <[email protected]> [04.01.2010 14:02]:
> Hello,
>  
> I have the following simple singleton implementation:
> 
> public class Singleton<T> : Object {
> 
>       private static T instance_;
> 
>      public static T instance() {
>          if (instance_ == null) {
>              instance_ = new T();
>          }
> 
>          return instance_;
>      }
> }
> 
> and I get the following error during compilation:
> 
> error: `Singleton.T' is not a class, struct, or error code
> 
> Wat is the point I'm missing?
> 
> Regards,
> Cem
> 
> _______________________________________________
> Vala-list mailing list
> [email protected]
 > http://mail.gnome.org/mailman/listinfo/vala-list
without testing it, try to use:

      public static T instance() {
          if (instance_ == null) {
              instance_ = Object.new( typeof( T ) );
          }
remember that this won't execute you default constructor. only construct
will be called. 

Regards, Frederik

-- 
IRC: playya @ Freenode, Gimpnet
xmpp: [email protected]

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to