Boost logo

Boost :

From: helmut.zeisel_at_[hidden]
Date: 2001-10-10 02:13:39


--- In boost_at_y..., Daryle Walker <darylew_at_m...> wrote:
> on 10/9/01 6:33 AM, Helmut at helmut.zeisel_at_a... wrote:
>

> >
> > I do not know whether compile-time gcd ever had worked under
VC++.
> > If my
> > brute-force workaround is considered to be sufficient,
> > I can help you to
> > identify the respective code fragment(s).
>
> I think the compile-time GCD from the pool library did have a
> version for
> VC++, using a #define-blocked separate implementation.
> It didn't work when
> I tried adapting it to my style. Could we see your suggestion?
>

The good news is that your code works under Linux/GCC 3.0.1
(at least for my simple tests).

Here are the changes I had to do for MSVC++ 6.0
(diff -u format; lines added are indicated by a "+",
line numbes are indicate by "@@",
some lines of context given):

1) BOOST_STATIC_ASSERT does not work under MSVC:

--- pending_ori\product_overflow.hpp Thu Oct 4 01:36:20 2001
+++ pending\product_overflow.hpp Wed Oct 10 08:38:06 2001
@@ -16,6 +16,11 @@
 #include <boost/pending/ct_if.hpp> // for boost::ct_if
 #include <boost/static_assert.hpp> // for BOOST_STATIC_ASSERT
 
+#ifdef BOOST_MSVC
+#undef BOOST_STATIC_ASSERT
+#define BOOST_STATIC_ASSERT(A)
+#endif
+

2) All the compile time stuff switched off:

--- math_ori\common_factor.hpp Thu Oct 4 01:44:56 2001
+++ math\common_factor.hpp Wed Oct 10 08:48:16 2001
@@ -56,6 +56,7 @@
 
 namespace detail
 {
+#ifndef BOOST_MSVC
     // Forward declarations
     template < unsigned long Value1, unsigned long Value2 >
         struct static_gcd_helper_t;
@@ -131,6 +132,7 @@
     {
         BOOST_STATIC_CONSTANT( unsigned long, value = 0UL );
     };
+#endif
 
     // Greatest common divisor for integers
     template < typename IntegerType >
@@ -168,7 +170,7 @@
 
 } // namespace detail
 
-
+#ifdef BOOST_MSVC
 // Compile-time greatest common divisor evaluator class declaration
 
--------//
 
 template < unsigned long Value1, unsigned long Value2 >
@@ -189,7 +191,7 @@
      = (detail::static_lcm_helper_t<Value1, Value2>::value) );
 
 }; // boost::static_lcm
-
+#endif
 
 // Greatest common divisor evaluator member function definition
------------//
 
 
 namespace boost
 {

 

As I said, it is a brute-force approach.
I did not try to repair anything, I just removed
the code that does not work under VC++
because I do not need it anyway.

Helmut


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk