
On 06/04/10 09:18, Steve Lorimer wrote:
Oooh, what's perfect forwarding?
Anyway, back to your previous question - no, I don't /hav/e to hide the boost::bind etc, but I think my concept will wrap up a lot of functionality rather nicely, and I don't think the calling point will look too ugly.
This is what I expect the creation of an event object to look like (using the code detailed below)
shared_ptr<event> ev = create_event
(obj, &foo::func, queue); // this for class *foo*, which has member *void foo::func(bar)* which we want to callback to To post an event to be processed by another queue will look like this
post_to_event<bar>(ev, data); // posts an object *data* of type *foo* to event *ev*
So here's the code that I have come up with - doesn't compile though (of course!) - what do you think? [snip] Steve, I tried compiling your code after slight modification to use variadic templates; however, I'm getting several minor errors. The 1st attachment is the code, the 2nd is the errors.
You might try correcting the minor errors and see if it compiles.
HTH.
-Larry
Compilation started at Sat Jun 5 15:13:26
make run
install -d `dirname /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_4v/boost-svn/ro/sandbox/variadic_templates/libs/composite_storage/sandbox/bind_function.o`
/home/evansl/download/stlfilt/gfilt -compiler:/home/evansl/download/gcc/4.4-20090630/install/bin/g++ -c -Wall -ftemplate-depth-300 -O0 -g3 -fno-inline -std=gnu++0x -DCXX0X_VARIADIC_TEMPLATES -I/home/evansl/prog_dev/boost-svn/ro/sandbox/variadic_templates -I/home/evansl/prog_dev/boost-svn/ro/sandbox/switch -I/home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/lje -I/home/evansl/prog_dev/boost-svn/ro/trunk -DTEMPLATE_DEPTH=300 bind_function.cpp -MMD -o /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_4v/boost-svn/ro/sandbox/variadic_templates/libs/composite_storage/sandbox/bind_function.o
COMPILE.cmd=/home/evansl/download/gcc/4.4-20090630/install/bin/g++ -c -Wall -ftemplate-depth-300 -O0 -g3 -fno-inline -std=gnu++0x -DCXX0X_VARIADIC_TEMPLATES -I/home/evansl/prog_dev/boost-svn/ro/sandbox/variadic_templates -I/home/evansl/prog_dev/boost-svn/ro/sandbox/switch -I/home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/lje -I/home/evansl/prog_dev/boost-svn/ro/trunk -DTEMPLATE_DEPTH=300 bind_function.cpp -MMD -o /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_4v/boost-svn/ro/sandbox/variadic_templates/libs/composite_storage/sandbox/bind_function.o
BD Software STL Message Decryptor v3.10 for gcc 2/3/4
bind_function.cpp:21: error: 'mutex' in namespace 'boost' does not name a type
bind_function.cpp:22: error: 'condition' in namespace 'boost' does not name a
type
bind_function.cpp:71: error: 'event' was not declared in this scope
bind_function.cpp:71: error: template argument 1 is invalid
bind_function.cpp: In member function 'void EventQueue::post(
boost::function