We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
template <typename K, typename M, typename H> HashMap<K, M, H>::HashMap(HashMap&& other) : _size(std::move(other._size)), _hash_function(std::move(other._hash_function)), _buckets_array(std::move(other._buckets_array)) { // 这里在 move constructor time test 那里会报错 other._buckets_array = {other._buckets_array.size(), nullptr} }
就是为什么不能直接对 other._buckets_array 进行 std::move() 右值转换的操作 而是
other._buckets_array
// move constructor template <typename K, typename M, typename H> HashMap<K, M, H>::HashMap(HashMap&& other) : _size(std::move(other._size)), _hash_function(std::move(other._hash_function)), _buckets_array(other._buckets_array.size(), nullptr) { for (size_t i = 0; i < other._buckets_array.size(); i++) { _buckets_array[i] = std::move(other._buckets_array[i]); other._buckets_array[i] = nullptr; } other._size = 0; }
遍历后挨个转换其中的 node* 元素
The text was updated successfully, but these errors were encountered:
No branches or pull requests
就是为什么不能直接对
other._buckets_array
进行 std::move() 右值转换的操作而是
遍历后挨个转换其中的 node* 元素
The text was updated successfully, but these errors were encountered: