Boost logo

Boost :

Subject: [boost] [container] [1.59.0b1] Behavioral (runtime) breakage with flat_xxx + ordered_unique_range + non-default comparator
From: Adam Merz (adammerz_at_[hidden])
Date: 2015-07-21 00:55:08


I've encountered a serious behavioral breakage for code using flat_xxx in
conjunction with ordered_unique_range and a non-default comparator in 1.59.0b1.
Here is a small repro:

    #include <initializer_list>
    #include <algorithm>
    #include <functional>
    #include <iterator>
    #include <iostream>
    #include <boost/container/flat_set.hpp>

    int main()
    {
        namespace bcont = boost::container;

        auto const p = [](auto const& desc, auto const& s)
        {
            std::cout << desc << ": ";
            std::copy(
                s.cbegin(), s.cend(),
                std::ostream_iterator<int>(std::cout, " ")
            );
            std::cout << '\n';
        };

        auto const r = {4, 3, 2};
        bcont::flat_set<int, std::greater<int>> const s{3, 2, 1};
        p("orig set", s);

        auto s1{s};
        s1.insert(r.begin(), r.end());
        p("without\tordered_unique_range (expected output)", s1);

        auto s2{s};
        s2.insert(bcont::ordered_unique_range, r.begin(), r.end());
        p("with\tordered_unique_range (erroneous output)", s2);
    }

    
I've worked around this locally by rerouting the ordered_unique_range codepath
to the default codepath, but this seems like a showstopper for 1.59.0 as the
code's behavior has broken entirely silently.

Regards,
Adam Merz


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk