0

I need to observer template with my Notification classes. I use this code:

#include <Poco/Notification.h>
#include <Poco/Observer.h>
#include <Util/RegisterObserver.h>
namespace RPC {
class ParseErrorNotify : public Poco::Notification{
public:
    ParseErrorNotify();


private:
    //std::string m_message;
};

template <class C>
class Observer:public Poco::Observer<C,ParseErrorNotify>{
    public:
        typedef Poco::Observer<C,ParseErrorNotify> Base;
        Observer(C& object, Base::Callback method):Base(object,method){}
};

}

But I have error while compile:

ParseErrorNotify.h:20:35: error: 'Poco::Base::Callback' is not a type

I'm using gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1). It's so strange, because with MSVC2010 on win compile ok.

Kopysov Evgeniy
  • 247
  • 1
  • 19

1 Answers1

0

It's not strange. You should use typename,

Observer(C& object, typename Base::Callback method):Base(object,method){}

since Callback is dependent-name. Read this Where and why do I have to put the "template" and "typename" keywords? for more information.

Community
  • 1
  • 1
ForEveR
  • 55,233
  • 2
  • 119
  • 133