Boost logo

Boost Users :

From: dmarsh26us (david.marsh10_at_[hidden])
Date: 2002-05-08 14:03:53


Here is an update from a discussion I've had with a fellow boost user.

The main problem appears to be the type traits classes which are
there to check whether certain template types support certain
language features.
The bool inside the class indicates the types conformance/non-
conformance to a certain test.
The problem seems to be the fact that VC6/7 does not support static
initializers within the class body. By changing the bool to just a
simple declaration and moving the initialising outside the class body
this language feature is no longer required.

I know Microsoft are dragging their feet on standards conformance,
but this feature is not strictly required for functionality reasons,
so the library authors could have put in a work around.

Can any of the library authors let me know of a suitable work around
for this using their Macros/config options? I don't want to just hack
my copy of the source unless I have too.

Regards

David Marsh
-----Original Message-----
From: Wayne Hartell [mailto:whar_at_[hidden]]
Sent: 08 May 2002 17:15
To: David Marsh
Subject: RE: [Boost-Users] Unable to compile Boost Graph (BGL)
inVisual Studio 7 (.NET)

Hi David,

I didn't get that far into it, but I was testing with the code form
Chapter 1.4 of the text (topological sort) and the edge connectivity
code at Chapter 8.2. I actually re-wrote the code from Chapter 8.2,
but you could simply include the pre-written edge connectivity header
to save time ;)

I got to the point where the code at CH1.4 would compile in Borland,
VC6 and VC7, but the code in Chapter 8.2 won't compile with any
compiler except GCC.

The work around I got for the first C1001 is as follows.

Even after using this work around (for VC7) I still run into another
C1001 with VC7 on the Chapter 8.2 code. VC6 also generates a C1001 at
a different location in the code.

I really started to wonder what the value was of working through the
compiler issues, when quite literally another issue ccould be lurking
in the next unexpanded template!

Hope this helps. I would love to hear if you get this working Ok.

Kind Regards,
Wayne Hartell

********************** The message for you follows
************************

I am Bobby Mattappally from Microsoft Developer Support. I have taken
the onwership of you issue
about getting C1001 when using the boost library. I am able to
confirm this to be a bug with VC.Net
C++ compiler. The error is happening the anonymous enum declaration
in a template class in one
of the boost library header files composite_traits.hpp line 158
below:
BOOST_STATIC_CONSTANT(bool, value= ....)

The workaround is to modify the is_array template class to use static
const bool instead of the
enum and defining it outside the class as below:

//begin code
template <typename T>
struct is_array
{
private:
   static T t;
public:
#if _MSC_VER == 1300
static const bool value;
#else

   BOOST_STATIC_CONSTANT(bool, value =
      (::boost::type_traits::ice_and<
         (1 == sizeof(detail::is_array_helper(&t, t))),
         ::boost::type_traits::ice_not<
            ::boost::detail::is_reference_or_const_volatile<T>::value>
::value,
         ::boost::type_traits::ice_not<
            (1 == sizeof(detail::is_function_tester(t)))>::value
>::value));
#endif

};
#if _MSC_VER == 1300
template <typename T>
 const bool is_array<T>::value = (::boost::type_traits::ice_and< (1
== sizeof(detail::is_array_helper(&t, t))),
::boost::type_traits::ice_not< ::boost::detail::is_reference_or_const_
volatile<T>::value>::value,
::boost::type_traits::ice_not< (1 == sizeof(detail::is_function_tester
(t)))>::value >::value); #endif

// end of code

-----Original Message-----
From: David Marsh [mailto:david.marsh10_at_[hidden]]
Sent: Wednesday, May 08, 2002 11:38 AM
To: Wayne Hartell
Subject: RE: [Boost-Users] Unable to compile Boost Graph (BGL)
inVisual Studio 7 (.NET)

Wanye,

Thanks for the info, I've only just started looking at boost, have
1.25, and 1.26 will get hold of 1.27 and try that also.
Have no trouble building with VC6 as of yet but have only built a
couple of examples as a test.
My main problem is with VC7, could you give me some more information
on what fix you obtained?
I'd also be interested in finding out what else you tried. What were
the subsequent errors?

Thanks

David Marsh
-----Original Message-----
From: Wayne Hartell [mailto:whar_at_[hidden]]
Sent: 08 May 2002 16:10
To: david.marsh10_at_[hidden]
Subject: RE: [Boost-Users] Unable to compile Boost Graph (BGL)
inVisual Studio 7 (.NET)

Hi,

My recent experience trying to compile the BGL with VC6/VC7 has been
pretty terrible. The VC compilers don't cope with templates too well
and BGL is template city. I got a work around from Microsoft for the
first C1001 (Internal Compiler Error) but when I hit the next two
(one in VC6 and one in VC7) I threw in the towel. I also tried and
had problems with Borland. I'd say if you can get away with GCC use
that. I was able to successfully compile an exe in GCC, but ran into
environment troubles when trying to link a DLL. I'd say the problem
there was my lack of experience with GCC, but I think you'll have the
best chance at success with GCC. Additionally, if you really need to
use VC, but don't have much time to get things on the road I'd
recommend you steer clear of BGL!!! BGL seems to be a very nice
looking library (I bought the book too), but when the examples in the
book don't even compile with 3 mainstream compilers I think it
indicates that there's still a little way to go to get it to the
stage where mere mortals like myself can get in and use it ;)

Oh, one thing I didn't try was getting the latest code from CVS. I
was working the whole time with 1_27_0, plus a few changes I made.

Kind Regards,
Wayne Hartell


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net