This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Is this a bug or lack of understanding?


Chris Picton wrote:
> But then my problem is.... How to output the map ordered by key length?

Perhaps you should use a multimap, or change your sort function to
use both length and lexicographic difference? Like this:

    struct s {
        bool operator()(string s1, string s2) {
            return (s1.size() < s2.size()
                    || s1 < s2);
        }
    };


-- 
Branko Čibej                 <branko.cibej@hermes.si>
HERMES SoftLab, Litijska 51, 1000 Ljubljana, Slovenia
voice: (+386 1) 586 53 49     fax: (+386 1) 586 52 70

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]