Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost-users Digest, Vol 2003, Issue 1
From: Tron Thomas (tron.thomas_at_[hidden])
Date: 2009-05-22 11:23:46


>
> 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
Yes, the declaration of m_objects should have been:

std::vector<AnotherObjectPtr;> 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?


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