Re: [Cppcms-users] init(content::base &) can't be used in derived class of cppcms::application
Brought to you by:
artyom-beilis
From: Artyom <art...@ya...> - 2011-01-30 15:20:32
|
Hello, There were new virtual member functions where added to cppcms::application: void init() void clear(); That are called upon URL Dispatching automatically. Because you have your own init(foo &) it overloads application::init and actually hides it. Because: struct foo { void init(); } struct bar : public foo { void init( int y); } Then: bar b; b.init() -- illegal as it hidden by overloaded version you need to add struct bar : public foo { void init( int y); void init() { foo::init(); } } So simplest thing you can do is to add to your app void init() {} if you don't use it at all Or better void init() { my_parent_class::init(); } So it would not be unhidden. All this for support of additional programming style when your application and context can be the same object which may be very convenient because it allows to access much more powerful tools from view. See exaples/message_board In the second thought.. I can fix it so it would work with overloading. Take rev. 1659, it should work fine. Artyom ----- Original Message ---- > From: kpeo <sla...@ya...> > To: cpp...@li... > Sent: Sun, January 30, 2011 4:41:20 PM > Subject: [Cppcms-users] init(content::base &) can't be used in derived class of >cppcms::application > > Hello Artyom and all! > > As i understood correctly, function like init(content::base &) can't be used >now in derived class of cppcms::application since r1653 of >cppcms/url_dispatcher.h, where new init() is now used. > > So we should to rename our init(content::base &) function to ini(content::x &) >for example, to avoid compile errors like: > > /usr/local/include/cppcms/url_dispatcher.h: In constructor >‘cppcms::url_dispatcher::page_guard<C, typename >booster::enable_if<booster::is_base_of<cppcms::application, C>, >void>::type>::page_guard(C*) [with C = app::project]’: > /usr/local/include/cppcms/url_dispatcher.h:210: instantiated from ‘void >cppcms::url_dispatcher::binder0<C>::operator()() const [with C = >app::project]’ > /usr/local/include/booster/function.h:163: instantiated from ‘void >booster::function<Result()>::callable_impl<void, F>::call() [with F = >cppcms::url_dispatcher::binder0<app::project>, Result = void]’ > /media/opnp/project.cpp:161: instantiated from here > /usr/local/include/cppcms/url_dispatcher.h:187: error: no matching function >for call to ‘app::project::init()’ > /media/opnp/project.cpp:49: note: candidates are: void >app::project::init(content::base&) > > /media/opnp/project.cpp:161 - end '}' of "namespace app {" > > /media/opnp/project.cpp:49: > > 46: project::project(site &s) : base(s) > 47: { > 48: // > 49: w.dispatcher().assign("^/?project/?(\\w+)?/?$",&project::out,this,1); > > So, i understand correctly and this is not a bug? > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |