Boost logo

Boost Users :

Subject: Re: [Boost-users] share_ptr and Container compilation error on new version
From: JB (general_at_[hidden])
Date: 2014-12-11 23:42:37


On 12/11/2014 20:52, Gruzauskas wrote:
> On 12/12/2014 9:03 AM, JB wrote:
>> Hello all,
>> I'm trying to build an application. This isn't an app that I wrote but
>> rather inherited. I'm currently porting it from Fedora 15 to Fedora
>> 20. It compiled well on gcc 4.6.3 with boost 1.46.0. However, Fedora
>> 20 has gcc 4.8.3 and boost 1.54. I'm new to boost and have never used
>> it before but it looks very comprehensive. As far as I know
>> boost/shared_ptr is the only header this component of the application
>> is including. I'm wondering if boost changes might be causing this or
>> maybe gcc changes but it's difficult to tell from the documentation
>> and I'm a little under the gun at the moment.
>>
>> This code:
>>
>> template<typename Container>
>> class DefinableVectorFinalizer: public XmlFinalizer
>> {
>> typedef typename Container::value_type contained_value_type;
>> typedef typename Container::value_type::value_type value_type;
>> ....
>> }
>>
>> g++ is throwing this error which seems to have some sort of problem
>> with Container::value_type::value_type:
>>
>> ../../../../../devel/include/xcl/io/DefinableVectorFinalizer.h:31:54:
>> error: no type named ‘value_type’ in
>> ‘xclApp::DefinableVector<boost::shared_ptr<simApp::Project>
>> >::value_type {aka class boost::shared_ptr<mainApp::Project>}’
>> typedef typename Container::value_type::value_type value_type;
>>
>>
>> xclApp::DefinableVector looks like this:
>> class DefinableVector
>> {
>> public:
>> typedef typename std::vector<T>::size_type size_type;
>> typedef typename std::vector<T>::value_type value_type;
>>
>> typedef value_type& reference;
>> typedef const value_type& const_reference;
>>
>> typedef typename std::vector<T>::iterator iterator;
>> typedef typename std::vector<T>::const_iterator const_iterator;
>> ....
>> }
>>
>> Any insight into this would be hugely appreciated!!!
>>
>
> Hi JB,
>
> I think your problem could be in the line:
>
> typedef typename Container::value_type::value_type value_type;
>
> try instead:
>
> typedef typename Container::value_type value_type;
>
>
> Arthur

Hi Arthur, thanks for the reply. There is already a declaration for
that. The intent of value_type::value_type was to access the value_type
attribute of the contained object. I read the header and actually found
the answer...I *think*...to be the following due to changes in boost
from 1.46 to 1.54:

typedef typename Container::value_type::element_type value_type;

That certainly resolved the compilation issue. I'll see if it works at
run time.

>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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