Re: [Vala] Implementing Singleton

* Cem Eliguzel <celiguzel ubicom com> [04.01.2010 14:02]:
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?


Vala-list mailing list
Vala-list gnome org
without testing it, try to use:

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

Regards, Frederik

IRC: playya @ Freenode, Gimpnet
xmpp: playya draugr de

Attachment: signature.asc
Description: Digital signature

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