Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#5710 closed Bugs (fixed)

ptree::sort() compilation error

Reported by: bolero.murakami+cpp@… Owned by: Sebastian Redl
Milestone: To Be Determined Component: property_tree
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:

Description

It is an error code:

boost::property_tree::ptree pt;
pt.sort();

Output (VC9):

c:\program files\microsoft visual studio 9.0\vc\include\utility(103) : error C2784: 'bool std::operator <(const std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem *)' : could not deduce template argument for 'const std::basic_string<_Elem,_Traits,_Alloc> &' from 'const boost::property_tree::basic_ptree<Key,Data>'
        with
        [
            Key=std::string,
            Data=std::string
        ]
        c:\program files\microsoft visual studio 9.0\vc\include\string(150) : see declaration of 'std::operator <'
        c:\program files\microsoft visual studio 9.0\vc\include\functional(143) : see reference to class template instantiation 'bool std::operator <<const Key,boost::property_tree::basic_ptree<Key,Data>>(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' being compiled
        with
        [
            Key=std::string,
            Data=std::string,
            _Ty1=const std::string,
            _Ty2=boost::property_tree::basic_ptree<std::string,std::string>
        ]
        c:\program files\microsoft visual studio 9.0\vc\include\functional(142): while compiling class template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const' being compiled
        with
        [
            _Ty=std::pair<const std::string,boost::property_tree::basic_ptree<std::string,std::string>>
        ]
        ...

No-argument ptree::sort() in the element less<pair<const string, ptree> > to be compared by.

However, this comparison operators are not defined. Therefore be a compilation error.

I think, the no-argument ptree::sort() should implemented by a comparison of key strings.

Change History (3)

comment:1 by Sebastian Redl, 11 years ago

Resolution: fixed
Status: newclosed

(In [76447]) Merge [72000],[72001],[72003], [74691], [75587], [75589], [75590], and [75593] from trunk. Fixes bug 4840. Fixes bug 5259. Fixes bug 5281, I think. Fixes bug 5944. Fixes bug 5757. Fixes bug 5710. Fixes bug 5307, I think.

comment:2 by anonymous, 11 years ago

I have this problem with Boost 1.48.0. Was this really fixed?

comment:3 by Sebastian Redl, 11 years ago

I changed it to fixed 5 days ago. 1.48 was released two months ago. Do the math.

Note: See TracTickets for help on using tickets.