unordered associative containers are non-copyable in profile mode

Jonathan Wakely jwakely.gcc@gmail.com
Tue Nov 8 23:51:00 GMT 2011


In profile mode all the unordered associative containers have a
constructor like this:

      unordered_map(const _Base& __x)
      : _Base(__x)
      {
        __profcxx_hashtable_construct(this, _Base::bucket_count());
        __profcxx_hashtable_construct2(this);
      }


Which isn't a copy constructor, so the presence of a move constructor
disables the implicit copy, giving:

count.cc: In function ‘void test01()’:
count.cc:59:34: error: use of deleted function
‘std::__profile::unordered_map<int, int>::unordered_map(const
std::__profile::unordered_map<int, int>&)’
In file included from
/home/jwakely/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/unordered_map:54:0,
                 from count.cc:23:
/home/jwakely/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/profile/unordered_map:56:11:
note: ‘std::__profile::unordered_map<int, int>::unordered_map(const
std::__profile::unordered_map<int, int>&)’ is implicitly declared as
deleted because ‘std::__profile::unordered_map<int, int>’ declares a
move constructor or move assignment operator


The obvious fix is simply to change the argument type, but is there a
reason it's defined that way?



More information about the Libstdc++ mailing list