Subject: [Boost-bugs] [Boost C++ Libraries] #7100: unorderd_set<shared_ptr<T> > > - insert does not increment count
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-07-07 03:59:01
#7100: unorderd_set<shared_ptr<T> > > - insert does not increment count
-----------------------------------------------+----------------------------
Reporter: Rich Eakin <reakinator@â¦> | Owner: johnmaddock
Type: Bugs | Status: new
Milestone: To Be Determined | Component: TR1
Version: Boost 1.51.0 | Severity: Problem
Keywords: unordered_set shared_ptr |
-----------------------------------------------+----------------------------
It seems unordered_set::insert has stopped working for shared_ptr's
between v 1.48 and now. Consider the following example:
{{{
#include <iostream>
#define USING_BOOST 1
#if USING_LIBCPP
#include <unordered_set>
#include <memory>
#elif USING_BOOST
#include "boost/shared_ptr.hpp"
#include "boost/unordered_set.hpp"
using namespace boost;
#endif
using namespace std;
int main()
{
unordered_set<shared_ptr<int> > mySet;
shared_ptr<int> intSP( new int( 1 ) );
cout << "use_count A: " << intSP.use_count() << endl;
mySet.insert( intSP );
cout << "use_count B: " << intSP.use_count() << endl;
return 0;
}
}}}
In boost-trunk (and release version 1.50), use_count after the insert is
still 1. In boost version 1.48, the use_count is incremented by the
insert to 2. This is also the case with libc++.
Sorry, I don't know what the results are in 1.49.
This was tested clang on Mac OS X:
{{{
$ clang --version
Apple clang version 4.0 (tags/Apple/clang-421.10.48) (based on LLVM
3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7100> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC