腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(9999+)
视频
沙龙
1
回答
std
::
less
<
int
>()(
int
,
int
)
可能
得到
错误
的
结果
c++
、
stl
当我写我
的
代码时,我
得到
了标题所说
的
错误
。这个
错误
出现在我
的
"splay“方法中: void splay(const KeyType& arg_key, Node*& tree) 这一行: if (key_
less
(arg_key, key(tree))) 我尝试输出关于这一行
的
一些消息,发现它总是
得到
一个'true‘
的
答案 代码:
std
::cerr <&
浏览 71
提问于2020-08-18
得票数 2
1
回答
操作符重载,用于生成一组类型为pair<
int
、
int
>
的
元素
c++
、
set
、
operator-overloading
如何重载“<”(小于)运算符,以便将此类型
的
元素插入到set中。例如,考虑以下程序#include <utility>using namespace
std
; set<pair<
int
,
int
> > s; s.insert(a)
浏览 0
提问于2015-09-22
得票数 1
回答已采纳
3
回答
如何模拟remove_unless
c++
、
c++11
、
c++14
、
erase-remove-idiom
我有代码从
std
::vector<
int
>中删除小于某些
int
limit
的
所有元素。我编写了一些部分应用lambdas
的
函数: return [=](
int
elem) { }; auto
less
_than_three =
less
_than_limit(
浏览 4
提问于2016-01-12
得票数 6
回答已采纳
1
回答
使用引用类型时使用比较函数失败
c++
、
templates
、
stl
我有一个模板化
的
类,如下所示(为简洁起见,假设使用using namespace
std
):void insert(const Type& from, const Type& to, double weight)
浏览 0
提问于2012-09-17
得票数 1
回答已采纳
1
回答
我不能在用较少比较器定义
的
映射中插入元素
c++
、
dictionary
、
comparator
我有以下地图:其中CustomClass是我用<运算符重载
的
类。但是我不能在这样
的
类中插入元素,当我使用以下代码时会
得到
一个
错误
:mp.insert
浏览 3
提问于2022-05-09
得票数 -1
2
回答
奇异分段断层与瓦砾分析
c++
、
map
、
segmentation-fault
、
valgrind
我增加了一些小
的
修改,这导致了最奇怪
的
分割
错误
。::pair<
int
,
int
> > > tBoxes;在代码
的
后期阶段,请注意: 还有其他一些我目前没有重点关注
的
内容。在一条与前面声明
的
双值相比较
的
行上(一个是在模拟中生成
的
第一个值,另一个是我希望检查
的
被确定<
浏览 3
提问于2012-03-22
得票数 0
1
回答
函数对象作为模板参数
c++
、
function-object
template <typename elemType, typename Comp =
less
<elemType> > public:_val = newval; }private:这是必不可少
的
c++
的
一个例子。通常,我认为我应该首先定义一个像这样
的
函数对象:Comp comp,然后调用comp而不是Comp
浏览 2
提问于2015-11-04
得票数 1
回答已采纳
1
回答
比较两组
std
::weak_ptr
c++
、
c++11
、
compare
、
std
、
stdset
下面的代码显示了
可能
出现
错误
的
最小示例:
std
::set<
std
::weak_ptr<
int
>,
std
::owner_
le
浏览 2
提问于2012-12-19
得票数 4
回答已采纳
1
回答
c++对堆对象
的
引用?
c++
、
reference
我有以下代码:但是,我
得到
了以下编译器
错误
: no suitable constructor exists to convertfrom "
std
::map<
int
,
int
,
std
::
less
<
int
>,
std
::a
浏览 2
提问于2018-06-06
得票数 1
回答已采纳
1
回答
使用
std
::在
std
::map不编译
c++
、
c++11
、
constructor
、
most-vexing-parse
我无法理解为什么下面的函数不编译#include <map>
std
::map<
int
,
int
,
std
::
less
<
int
>>myMap(
std
::
less
<
int
>());
std
::cout << myMap[2]
浏览 0
提问于2021-01-25
得票数 4
回答已采纳
1
回答
在诱惑继承中忽略
的
虚拟方法
c++
、
templates
、
inheritance
、
virtual
这就是我想要
得到
的
行为:class Base protected::
less
<T>>public:}; { Base<
int
浏览 8
提问于2022-06-09
得票数 0
回答已采纳
1
回答
std
::
less
<
int
>
的
正确参数类型是什么?
c++
、
templates
我正在创建一个类--一个BST --可以比较需要比较器(如
std
::
less
)
的
模板化节点。tree<
int
> my_bst (
std
::
less
<
int
>); bst::tree<
int
> my_bst (
std
::
less
<
int
&
浏览 0
提问于2018-10-01
得票数 6
回答已采纳
1
回答
在gdb中从模板类
的
成员函数中打印静态变量
c++
、
debugging
、
gcc
、
gdb
我正在使用gdb版本: 7.6.1正如建议使用gdb自动完成
的
那样,我能够
得到
以下内容: p 'test::DB<
std
::string,
std
::string,
std
::map<
std
::string,
std
::string,
std
::
less
<
std
::string>,
std
::allocator<
std
::pair&l
浏览 0
提问于2016-09-27
得票数 6
回答已采纳
3
回答
位块
的
比较与计数
c++
、
bit-manipulation
我有一个非常具体
的
问题,我想听听你
的
意见:到目前为止,我正在使用if-构造并创建一个应用于整数并调用__builtin_popcount()
的
位掩码。下面是一个示例,说明如何检查32位整数上
的
word是否为<= 01。__builtin_popcount(~(word | 0x55555555)) 不幸
浏览 4
提问于2016-04-27
得票数 2
1
回答
如何从VC6中
的
范围构造
std
::map
c++
、
stl
、
visual-c++-6
<
int
const ,
int
,struct
std
::
less
<
int
const >,class
std
::allocator<
int
> >(const struct
std
::
less
<
int
const,struct
std
::
less
<
int
const >,class
std
::a
浏览 10
提问于2013-10-13
得票数 2
1
回答
如何比较两个以
std
::weak_ptr为键
的
std
::map?
c++
、
c++11
、
comparison
、
weak-ptr
0; }/usr/include/c++/4.8/bits/stl_pair.h: In instantiation of ‘constexpr选项1和2只是为了测试而不是选项;3是
可能
的
,但是我想了解为什么我会
得到
这个
错误
,如果
可能
的话使用标准库。但是它不起作用(至少对g++ 4.8.{1,2}不起作用),因此我
的
问题是
浏览 2
提问于2013-12-30
得票数 2
回答已采纳
3
回答
如何在包含类
的
向量中使用
std
::
less
c++
如何在包含类
的
向量中使用
std
::
less
,所有google
结果
都是简单
的
int
示例。,比如:
Less
将
得到
A,而不是
int
。
std
::
less
< A > 似乎更少需
浏览 3
提问于2012-11-23
得票数 0
回答已采纳
1
回答
使用模板调用
std
::
less
<
int
>::operator()会导致分割
错误
c++
、
templates
、
c++11
、
stl
当我运行它时,当我调用函数insert.And (我用gdb进行调试)时,我遇到了一个分段
错误
--它告诉我问题
的
原因,因为call
std
::
less
<
int
>::operator().I已经看到了,但是我仍然认为我错了Value>** forward; template <typename KeyValue,typename Value, typename KeyCmp =
std
::
less
&l
浏览 0
提问于2016-03-03
得票数 1
回答已采纳
1
回答
优先级队列没有名为top()
的
成员?
c++
、
templates
、
stl
、
priority-queue
、
comparator
下面是我
的
比较类:class EdgeComparator{ bool operator()(
std
::pair<Edge}下面是我
的
优先级队列init:
std
::priority_queue<
std
::pair<Edge<T>,
int
>,
std</e
浏览 2
提问于2016-01-31
得票数 0
3
回答
STL集合交集和输出
c++
、
stl
、
set-intersection
然而,我
得到
了构建
错误
: c:\program files (x86)\microsoft visual studio 10.0\vc\include\algorithm(4494): error C3892::_Tree_const_iterator<
std
::_Tree_val<
std
::_Tset_traits<
int
,
std
::
less
<
int
>,
std
::allocator<
int
浏览 0
提问于2012-02-06
得票数 7
回答已采纳
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
为什么对byte的操作会得到int的结果
C+实验四:指针和数组
从零开始学习C+编程——数据计算
C++20:核心语言
C+存储类
热门
标签
更多标签
云服务器
即时通信 IM
ICP备案
对象存储
实时音视频
活动推荐
运营活动
广告
关闭
领券