|
Boost : |
From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2004-09-22 05:42:59
John Torjo <john.lists_at_[hidden]> wrote:
> I just took your implementation
> (http://www.pdimov.com/cpp/shared_count_x86_exp2.hpp) for shared_ptr
> and use it now in win32gui (upcoming v1.4.2). Using Interlocked* for
> win32 totally rocks!
>
> From my tests - Interlocked* are very fast. They're about twice as
> slow as a raw increment (or my tests are wrong;)).
>
> From what I see - I think you can certainly merge them into
> boost::shared_ptr.
> Maybe users can select the old version or this Interlocked* version
> with a certain macro - like BOOST_SHARED_PTR_USE_INTERLOCKED.
>
> Also, why not including windows.h directly, like this:
> #define WIN32_LEAN_AND_MEAN
> #include <windows.h>
<snip>
"Lean" is a bit of a joke. A rather smaller set of Windows
definitions can be included by defining an architecture-identifying
macro (e.g. _X86_ for i386) followed by:
#define NOMINMAX // inhibits definition of min and max macros in
// <windef.h>
#include <windef.h>
#undef NOMINMAX
#include <stdarg.h> // <winbase.h> requires definition of va_arg
#include <winbase.h>
Unfortunately this still defines quite a few macros.
The MSDN Library documentation of Win32 functions will tell you
about any additional headers that need to be included, even though
it recommends you include <windows.h> instead.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk