腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(9999+)
视频
沙龙
2
回答
为什么
insert
in
std
::
unordered_set
调用
复制
构造
函数
?
c++
、
insert
、
unordered-set
我有一个指针的
std
::
unordered_set
。如果我这样做了 int main()
std
::
unordered_set
<
std
::unique_ptr<int>> set;} 一切正常,
insert
调用
move
构造
函数
(我想)。它给了我们 状态错误C2280 '
std</
浏览 55
提问于2021-04-23
得票数 3
回答已采纳
3
回答
unordered_set
使用值对象地址的散列
c++
、
c++11
、
hash
、
c++-standard-library
我有一个类,它需要有一个
std
::
unordered_set
,它包含不可
复制
的、不可移动的实体对象,并且其散列
函数
哈希实例的地址。}{
std
::
unordered_set
<A> entities;如果总是使用emplace()而不是
insert
(),那么以这种方式使用
unordered_set
标准是否指定实现在
构造
节点对象后不能移动它们? 如果A是可移动的呢?它
浏览 10
提问于2013-10-13
得票数 3
回答已采纳
1
回答
C++
unordered_set
insert
接受
构造
函数
参数?
c++
、
hash
、
hashtable
string getName() const; void setEMail(string eMail);而这个类包含一个
unordered_set
UserRecord& ur2) const return ur1.getEMail()==ur2.getEMail();}; HashTabUserRecord
浏览 7
提问于2022-02-10
得票数 0
回答已采纳
1
回答
gcc和clang抛出“无匹配
函数
调用
”,但msvc (cl)按预期编译和工作。
c++
、
gcc
、
clang
、
c++17
、
cl
<
std
::
unordered_set
<
std
::__cxx11::basic_string<char> > >&)'void impl::join(
std
::
insert
_itera
浏览 0
提问于2018-04-03
得票数 7
回答已采纳
2
回答
基于
unordered_set
的怪异迭代器行为+分段故障
c++
、
c++11
、
unordered-set
我有一个具有
unordered_set
<int>成员的类,如下所示:#include <HexBoard(const HexBoard &obj); private:
浏览 4
提问于2017-02-04
得票数 4
回答已采纳
2
回答
std
::
unordered_set
<T>::
insert
(T&&):如果参数存在,是否移动
c++
、
c++11
这个问题是关于C++11标准库中几个
函数
的规范,这些
函数
将它们的参数作为右值引用,但并不是在所有情况下都使用它们。
std
::
unordered_set
<T>::
insert
(T&&)就是一个例子。很明显,此方法将使用T的move
构造
函数
在容器中
构造
元素(如果元素尚不存在)。但是,如果该元素已经存在于容器中,会发生什么呢?我非常确定没有理由改变这种情况下的对象。这里有一个例子来说明
为什么
这可能很有趣。下面的代
浏览 0
提问于2012-04-06
得票数 17
回答已采纳
1
回答
VC10
unordered_set
/map移动
构造
函数
错误?
visual-studio-2010
、
unordered-map
、
unordered-set
、
move-constructor
似乎在VC10 (Visual Studio2010)下的
unordered_set
/map的移动
构造
函数
在被
调用
后将右侧置于未定义的状态,导致其他操作(如'
insert
')严重失败。#include <set>#include <
unordered_set
>
浏览 2
提问于2012-10-09
得票数 1
回答已采纳
1
回答
C++:没有重载
函数
unordered_set
的实例
c++
、
visual-studio
我不明白
为什么
编译器一直抱怨我试图将Employee的unique_pointer插入到Employee的
unordered_set
中。你能指出我错过了什么吗?.using namespace
std
;#include<vector> #include "c++ test ConsoleAppl
浏览 6
提问于2018-08-07
得票数 1
2
回答
C++将所有元素从向量
复制
到map / unordered_map的最佳方法
c++
、
set
、
unordered-map
、
unordered-set
使用C++,如果我想将vector转换为set或
unordered_set
容器,可以很容易地通过以下方法完成:#include <map>#include <unordered_map>#include <vector> vector<int> vec {1
浏览 2
提问于2020-06-05
得票数 0
回答已采纳
2
回答
如果有
insert
/remove/rehash操作,unordered_map会
复制
/释放包含的对象吗?
c++
、
boost
、
stl
我想在unordered_map中存储小对象,只是想知道如果有任何插入/删除/重新散列操作,它是否可以
复制
/释放包含的对象?我认为unordered_map使用链表来存储键/值对,它应该不需要
复制
/释放像vector这样的对象来进行内存重新分配。
浏览 1
提问于2011-12-29
得票数 8
回答已采纳
1
回答
C++
unordered_set
<
insert
function>返回值
c++
、
stl
、
unordered-set
我正在尝试检查
unordered_set
的
insert
()
函数
的返回值,但仍然存在以下错误:t.
insert
(1);t.
insert
(3);
std
::
unordered_set
<int>::iterator it = t.
insert
(1); **//Er
浏览 10
提问于2021-02-06
得票数 1
回答已采纳
1
回答
是否有一种方法可以在
unordered_set
中保留对对象的引用/指针?
c++
、
pointers
、
reference
、
stl
、
unordered-set
这些class A对象必须永远不被
复制
或任何东西,因为它们包含的成员数据应该被class B和class A的不同对象使用和更改(共享正在使用)。因此,散列
函数
需要是class A的公共成员
函数
。但是,我想知道,因为
std
::
unordered_set
::
insert
()似乎引用了一个value_type,是否可以只使用A作为
std
::
unordered_set
的值类型。但是,我不确定
std
::
unordered_set</e
浏览 1
提问于2020-03-28
得票数 0
回答已采纳
4
回答
unordered_set
在unordered_map中的嵌入
c++
、
c++11
、
move
、
unordered-map
、
emplace
如何将(静态定义的)
unordered_set
添加到unordered_map中,而不必
复制
unordered_set
?(i, {"foo", "bar"});
std
::unordered_map<int,
std
::
unordered_set
<
std
::string>> my_map; my_map.
insert
(
浏览 3
提问于2015-06-24
得票数 4
回答已采纳
1
回答
不带
复制
对象的c++17插入到
std
::map中
c++
、
c++17
在C++17中,每次
调用
std
::map
insert
或emplace ?时,都会
调用
下面的
为什么
复制
构造
函数
。class A{ A(int intID): intID(intID){ A(const A &a){
std
::cout << &qu
浏览 0
提问于2020-09-30
得票数 0
1
回答
当我忘记递增迭代器时使用
std
::bad_alloc
c++
、
bad-alloc
首先,我最初忘记递增循环,因此在运行代码时得到了
std
::bad_alloc。在调试之后,我不太明白
为什么
这个错误会导致这个错误。我可以避免
复制
它们吗?replacement over a range using Bob Floyd's algorithm{
std
::
unord
浏览 12
提问于2019-08-27
得票数 0
3
回答
在c++中将常规的`set`转换为boost的`
unordered_set
`
c++
、
boost
下面是一个例子:temp.
insert
(5);temp.
insert
(7); s.
insert
(temp);
unordered_set
<
unordered_set
<int
浏览 0
提问于2012-10-23
得票数 2
回答已采纳
3
回答
分裂向量到唯一和重复的c++
c++
、
algorithm
、
sorting
、
split
、
unique
myVecDuplicate=myVec(firstDuplicate,myVec.end());\\here error accures that says ' no match for call to '(
std
::vector<int>) (
std
::vector<int>::iterator&,
std
::vector<int>::iterator)' vector<int> myVecUnique=myVec(myVec.begin()+firs
浏览 9
提问于2016-11-07
得票数 1
回答已采纳
3
回答
确定C++11
unordered_set
中是否发生冲突
c++
、
c++11
我在玩C++11,我试图向一个无序集合添加元素,如果我已经向我的
unordered_set
添加了一个元素,我不想再添加它(即)。不要将cat再次添加到下面的无序集合中。
std
::
unordered_set
<
std
::string> s; for
浏览 1
提问于2014-02-22
得票数 0
2
回答
移动语义不完整吗?
c++
、
c++11
、
language-features
、
move-semantics
在
复制
效率低下的情况下,移动语义替换
复制
语义。
复制
语义完全处理可
复制
的对象,包括const对象。我建议移动析构
函数
可以作为移动语义模型的一个有价值的补充。考虑一个简单的情况,在unique_ptr中使用
unordered_set
。您可以使用移动
浏览 2
提问于2014-01-13
得票数 10
回答已采纳
1
回答
C++奇怪的参数传递
gcc
、
c++11
& G,
std
::
unordered_set
<node>& community, virtual~NodeClusterSimilarity(); };GreedyCommunityExpansion::Acceptabili
浏览 1
提问于2013-06-14
得票数 1
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
Visual Studio:优化了复制/移动省略
C+11并发编程:多线程std:thread
C+11移动构造函数详解
这几个C+的坑,一旦踩中了,加班是肯定避免不了了!
C+之右值引用
热门
标签
更多标签
云服务器
即时通信 IM
ICP备案
对象存储
实时音视频
活动推荐
运营活动
广告
关闭
领券