Boost logo

Boost Users :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2004-11-11 09:34:50


"Arno Schäfer" <arno.schaefer_at_[hidden]> wrote in message
news:loom.20041111T112856-665_at_post.gmane.org...
> Hi,
>
> if I want use the boost libs in an existing MFC/AFX environment I have a
lot of
> compiling problems, what seems to depend on the order of includes. One
problem
> what I see, but I don't understand, is the following compile error:
>
> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for
80x86
> Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
> cl /MDd /W3 /GR /GX /Zi /Od /I ...bunch of
> includes... /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_SECDLL" /D "_AFXDLL"
/D "_
> MBCS" /D "_GXDLL" /D "NOMINMAX" /D "_SECNOMSG" /D "_GXNOMSG" /D
"_SFLNOMSG" /Fp"
> D:\temp\debug\GUIClient/Plato.pch" /YX"stdafx.h"
/Fo"D:\temp\debug\GUIClient/" /
> Fd"D:\temp\debug\GUIClient/" /FD /Zm200 /GZ /c
"F:\Gui+Client\src\AboutDlg.cpp"
> AboutDlg.cpp
> Note: Using precompiled header
> Automatically linking with RWUXThemeSD.lib
> ..\..\PlatoServer\Basics\boost\inc\boost/detail/iterator.hpp(326) : error
> C2039: 'difference_type' : is not a member of 'Iterator'
>
..\..\..\libs\stingray\objective_studio\include\foundation\Patterns\Iter
> ator.h(77) : see declaration of 'Iterator'
> ..\..\PlatoServer\Basics\boost\inc\boost/detail/iterator.hpp(331)
: see
> reference to class template
> instantiation 'boost::detail::standard_iterator_traits<Iterator>' being
compiled
> ...
>
> So it looks like, that the template parameter "Iterator"
> in "boost::detail::standard_iterator_traits<Iterator>" conflicts with the
> template class "stingray::foundation::Iterator" in some header files from
the
> GUI control stuff, what was included before the boost header. How is this
> possible, what has the template parameter "Iterator" in the
> namespace "boost::detail" to do with the template class "Iterator" in the
> namespace "stingray::foundation" has anybody an explaination for this?

My guess is that if you read the error message literally, it's telling you
that somewhere in _your_ code you are (indirectly?) trying to instantiate a
boost::standard_iterator_traits struct using a RogueWave Iterator. The
RogueWave iterator is _not_ a standard conforming iterator. It does not have
the requisite typedefs as shown below:

template <typename _Elem>
class IteratorBase
{
public:

 typedef _Elem Element;
 virtual ~IteratorBase() {}

public:
 virtual Element Next() = 0;
 virtual Element Prev() = 0;
 virtual Element Current() = 0;
 virtual bool Finished() = 0;
 virtual void Start() = 0;
};

template <typename _Aggr, typename _Iter = _Aggr::iterator, typename _Elem =
_Aggr::value_type>
class Iterator
 : public IteratorBase<_Elem>
{
public:
 explicit Iterator(_Aggr& acollection): _coll(acollection) {Start();}

public:

 // Polymorphic iteration methods
 virtual Element Next();
 virtual Element Prev();
 virtual Element Current();
 virtual bool Finished();
 virtual void Start();

private:
 _Aggr& _coll;
 _Iter _it;
};

I've inherited a couple of MFC projects using both Roguewave and boost
extensively without "conflict".

Jeff F


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