Boost logo

Boost Users :

From: Joshua (animedemon_at_[hidden])
Date: 2002-10-23 10:41:03


--- In Boost-Users_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
> From: "Joshua" <animedemon_at_h...>
> > I'm just trying to include the files for the shared_ptr class and keep
> having problems. I was able to fix a problem with a duplicate definition of
> 'max' and 'min' (in suffix.hpp, it was conflicting with a file from the SGI
> STL implementation) I mainly just commented it out, if someone has a better
> plan on how to fix it I would love to know how to fix it. I have tried Boost
> 1.28 and 1.29 and still got the same set of errors. In addition to the 'max'
> and 'min' conflict I am getting these errors :
> > e:\programming projects\c++
> projects\boost_1_28_0\boost\checked_delete.hpp(24) : error C2061: syntax
> error : identifier 'T'
> > e:\programming projects\c++
> projects\boost_1_28_0\boost\checked_delete.hpp(24) : error C2061: syntax
> error : identifier 'T'
> > e:\programming projects\c++
> projects\boost_1_28_0\boost\checked_delete.hpp(30) : error C2061: syntax
> error : identifier 'T'
> > e:\programming projects\c++
> projects\boost_1_28_0\boost\checked_delete.hpp(30) : error C2061: syntax
> error : identifier 'T'
> > e:\programming projects\c++
> projects\boost_1_28_0\boost\detail\shared_count.hpp(184) : error C2504:
> 'counted_base' : base class undefined
> > e:\programming projects\c++
> projects\boost_1_28_0\boost\detail\shared_count.hpp(206) : see reference to
> class template instantiation 'detail::counted_base_impl<P,D>' being compiled
> > e:\programming projects\c++
> projects\boost_1_28_0\boost\detail\shared_count.hpp(253) : error C2061:
> syntax error : identifier 'Y'
> > e:\programming projects\c++
> projects\boost_1_28_0\boost\detail\shared_count.hpp(254) : error C2065: 'Y'
> : undeclared identifier
> > e:\programming projects\c++
> projects\boost_1_28_0\boost\detail\shared_count.hpp(390) : fatal error
> C1506: unrecoverable block scoping error
>
> Looks like the SGI STL has the "helpful"
>
> #define typename
>
> somewhere. Fix this (MSVC usually doesn't need this hack) or change all
> "typename T" template parameters to "class T".

I was wondering if that would fix the problem, it only seems to be in those 2 locations (that I've found so far). I fixed the Min/Max redefinition problem so I'll do a global replace of typename T to class T when I get back home. The only thing I wonder about is that 'typename' appears to be a reserved word in VC++ (its highlighted blue) so is a direct replacement of 'typename' with 'class' appropriate? I haven't done much indepth template programming experience but spending 5 minutes on google I got this :
(exerpt from http://msdn.microsoft.com/msdnmag/issues/02/09/CQA/default.aspx)

"Now the compiler knows T::Bletch is a type, not a member name. You
can also use <typename T> instead of <class T> in the template definition. The following statements are identical:
template<class X>...
template<typename X>...

This should answer the question."
So, yes, that did answer my question :) Isn't the internet grand :)
Thanks I'll let you guys know how it goes when I get home (don't have VC++ at work).
Joshua.


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