[C++-sig] Improved version of Lijun Qin's multithreading patch
by Niall Douglas other posts by this author
Oct 25 2003 9:26PM messages near this date
[C++-sig] Re: Extracting C++ objects: documentation example fails.
|
[C++-sig] Pyste bug: protected virtual methods
Attached is an improved version of Lijun Qin's patched invoke.hpp for
multithreading. This version solves the following problems:
1. I couldn't find any member function traits in Boost. Odd they
should be missing, but missing they are from all copies I have.
2. Even if you /do/ have both sets of function traits, they only go
up to 10 parameters, not BPL's max arity.
3. If you had member variables eg; def_readwrite(), the old patch
failed to compile.
4. The old patch failed when the parameter types did not have a copy
constructor.
5. The old patch wrapped each call in a try...catch() which is
inefficient.
Steps taken:
1 & 2: I've added my own custom partial specialisation for functions
and member functions using the exact same preprocessor repeat as
invoke.hpp uses. Thus the full range of parameters is available.
3: I've added specialisations of detail::member and detail::datum
with type extractions.
4: I've utilised call_traits to hold converted parameters as
references where possible. As the C++ standard guarantees an object
must exist as long as a reference created initialised to it, this is
fine.
5. There's now an object which RAII.
Q: Should I make the return type also a reference? Should save a copy
construction, but I would need to take call_traits<> ::param_type and
remove the const-ness.
Cheers,
Niall
_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig
|