[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: kconfigxt singleton problem?
From:       Robert Hogan <robert () roberthogan ! net>
Date:       2006-06-07 19:02:22
Message-ID: 200606072002.22509.robert () roberthogan ! net
[Download RAW message or body]

On Tuesday 06 June 2006 23:33, Alexander Petrov wrote:
> Hi,
>
> On Wednesday 07 June 2006 01:38 Robert Hogan wrote:
> > mykconfigxt.h:
> >     static
> >     bool defaultMaxMinOptions()
> >     {
> >       return self()->mDefaultMaxMinOptions;
> >     }
> >
> >
> > my.cpp:
> >
> > bool (MyKConfigxt::*pt2Member)() = NULL;
> > pt2Member = &MyKConfigxt::defaultMaxMinOptions;
> >
> > gives
> > error: cannot convert `bool (*)()' to `bool (MyKConfigxt::*)()' in
> > assignment
>
> you need Class::*memfun syntax only for non-static member functions,
> so either remove 'static' from defaultMaxMinOptions() declaration or define
> pointer as pointer to free-standing function and use your static function
> as pointee:
>
> bool (*funptr)() = NULL;
> funptr = &MyKConfigxt::defaultMaxMinOptions;
>
> btw: consider using Boost.Bind / Boost.Function, which are very flexible
> classes to bind to functions

interesting.  not sure i understand why the difference arises though in the 
treatment of static vs non-static members for pointers. where can i look for 
an explanation?

thanks for all the answers!
-- 

http://www.klamav.net
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic