|
Boost Users : |
Subject: [Boost-users] Compile errors using BOOST_FOREACH on Fedora Linux
From: Tron Thomas (tron.thomas_at_[hidden])
Date: 2009-05-21 22:40:11
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<std::vector<boost::shared_ptr<AnotherObject>,
std::allocator<boost::shared_ptr<AnotherObject> > > >*)
.../SomeObject.cpp:110: error: no matching function for call to
not_(boost::foreach::is_noncopyable<std::vector<boost::shared_ptr<AnotherObject>,
std::allocator<boost::shared_ptr<AnotherObject> > > >*)
.../SomeObject.cpp:110: error: no matching function for call to
not_(boost::is_array<std::vector<boost::shared_ptr<AnotherObject>,
std::allocator<boost::shared_ptr<AnotherObject> > > >*)
.../SomeObject.cpp:110: error: no matching function for call to
not_(boost::foreach::is_noncopyable<std::vector<boost::shared_ptr<AnotherObject>,
std::allocator<boost::shared_ptr<AnotherObject> > > >*)
.../SomeObject.cpp:110: error: no matching function for call to
not_(boost::is_array<std::vector<boost::shared_ptr<AnotherObject>,
std::allocator<boost::shared_ptr<AnotherObject> > > >*)
.../SomeObject.cpp:110: error: no matching function for call to
not_(boost::foreach::is_noncopyable<std::vector<boost::shared_ptr<AnotherObject>,
std::allocator<boost::shared_ptr<AnotherObjecth> > > >*)
These error are quite puzzling, and I'm not sure what is causing the
problem especially since the code compiled fine on another platform,
which suggests it might be fine.
What is needed to fix this problem so the code will compile successfully?
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