|
Boost : |
From: angelo_at_[hidden]
Date: 2001-07-25 19:56:33
I have modified the code of boost/pool library so that it can be
compiled by
MSVC 6.0. Here's the summary on what should be changed.
-----------------------------------------
boost/pool/detail/mutex.hpp
---------------------------------------
1. MSVC use the macro _WIN32 instead of __WIN32__, so
"#ifdef __WIN32__" should be changed to "#if defined(__WIN32__)
||
defined(_WIN32)".
2. MSVC defined _MT when multithread is enabled, so the following code
should be added :
#if defined(_WIN32) && !defined(_MT) && !defined(BOOST_NO_MT)
#define BOOST_NO_MT
#endif
-------------------------------------------
boost/pool/detail/singleton.hpp
-------------------------------------------
MSVC has problem when the class singleton_default has private members.
Comment the line with "private:" in class singleton_default.
---------------------------------------------
boost/pool/detail/ct_gcd_lcm.hpp
------------------------------------------------
MSVC does not support partial specialization, so the ct_gcd
implementation
does not work.
The following code works on MSVC.
template <unsigned A, unsigned B>
struct ct_gcd
{
BOOST_STATIC_CONSTANT(unsigned, A_mod_B_ = (A % (B == 0 ? 1 :
B) ) );
BOOST_STATIC_CONSTANT(bool, cond_ =
(::boost::type_traits::ice_eq<A_mod_B_, 0>::value) );
BOOST_STATIC_CONSTANT(unsigned, value = (cond_ ? B : ct_gcd<B,
A_mod_B_>::value) );
};
template <>
struct ct_gcd<0,0>
{
BOOST_STATIC_CONSTANT(unsigned, value = 0);
};
After all these change are made, the singleton_pool can be compiled
by MSVC.
Huang-Ming Huang
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk