On Wed, Oct 8, 2008 at 12:05 PM, Roy Stogner <[EMAIL PROTECTED]> wrote:
>
> On Wed, 8 Oct 2008, John Peterson wrote:
>
>> I'm a little nervous about casting a function pointer to a void*.
>> Technically this is not allowed (something about void* being reserved
>> for data pointers, google for "function pointer to void*" on
>> comp.lang.c++.moderated) which I assume is why you have used the
>> implementation-defined reinterpret_cast.  I think the main problem is
>> that "a void* is not required to be of adequate size to hold a
>> function pointer" but it is on all POSIX systems.
>
> Good catch.
>
>> One possiblity might be instead of a vector<void*> for inner_ctx, a
>> pair<void*, void(*)(void)> unless you anticipate adding more and more
>> stuff to the inner_ctx vector...
>
> How about a functor abstract base class?  Anyone?  We are using C++
> still, right?  ;-)

I briefly considered this but MatShellSetOperation does required a
pointer to a void(void) function to be passed.

http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatShellSetOperation.html

With a function object or even just a non-static member function of
the class, can this be done with some mem_fun tricks, e.g.

mem_fun(&Foo::the_function)

?

-- 
John

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to