This is the mail archive of the libstdc++@gcc.gnu.org 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]
Other format: [Raw text]

unordered associative containers are non-copyable in profile mode


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?


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