I have a class defined like this:
class SomeObject
{
public:
...
virtual void Method();
...
private:
typedef boost::shared_ptr<AnotherObject> AnotherObjectPtr;
...
std::vector<AnotherObject> m_objects;
...
};
void SomeObject::Method()
{
...
BOOST_FOREACH(AnotherObjectPtr object, m_objects){
object->DoSomething();
}
}
The code compiles fine using Boost 1.39.0 on Mac OS X 10.5 (PowerPC).
However, when I compile the same code on Fedora 10 (Intel), I get
compile errors like:
.../boost_1_39_0/boost/foreach.hpp:221: error: expected
nested-name-specifier before ‘int’
.../boost_1_39_0/boost/foreach.hpp:221: error: two or more data types in
declaration of ‘parameter’
.../boost_1_39_0/boost/foreach.hpp:222: error: default template
arguments may not be used in function templates
.../SomeObject.cpp: In member function ‘virtual void SomeObject::Method()’:
.../SomeObject.cpp:110: error: no matching function for call to
‘not_(boost::is_array
Tron Thomas wrote:
I have a class defined like this:
class SomeObject { public: ...
virtual void Method();
...
private: typedef boost::shared_ptr<AnotherObject> AnotherObjectPtr;
...
std::vector<AnotherObject> m_objects;
... };
void SomeObject::Method() { ...
BOOST_FOREACH(AnotherObjectPtr object, m_objects){ object->DoSomething(); } }
The code compiles fine using Boost 1.39.0 on Mac OS X 10.5 (PowerPC).
That's surprising since m_objects is a vector of AnotherObject, not a vector of AnotherObjectPtr. (Hint: *always* post the actual code that is failing.) -- Eric Niebler BoostPro Computing http://www.boostpro.com
(Please don't reply to digests. Thanks.) Tron Thomas wrote:
Eric Niebler wrote:
Tron Thomas wrote:
I have a class defined like this:
class SomeObject { public: ...
virtual void Method();
...
private: typedef boost::shared_ptr<AnotherObject> AnotherObjectPtr;
...
std::vector<AnotherObject> m_objects;
... };
void SomeObject::Method() { ...
BOOST_FOREACH(AnotherObjectPtr object, m_objects){ object->DoSomething(); } }
The code compiles fine using Boost 1.39.0 on Mac OS X 10.5 (PowerPC).
That's surprising since m_objects is a vector of AnotherObject, not a vector of AnotherObjectPtr. (Hint: *always* post the actual code that is failing.)
Yes, the declaration of m_objects should have been:
std::vector
m_objects; That is consistent with the actual code where the problem is happening.
Given that what do people know about how to fix the compiler error?
Please post source code that demonstrates the error. Nobody can help you until we know what the problem is. -- Eric Niebler BoostPro Computing http://www.boostpro.com
participants (2)
-
Eric Niebler
-
Tron Thomas