腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
Python
中
std
::
less
的
补充
python
、
comparison
我是一个
Python
新手,但有很好
的
C++经验。我正在尝试写一些代码,我想在其中使用基于某些条件
的
<和>函数。 最好
的
方法似乎是创建一个函数指针,并根据某些条件对其进行初始化。我知道我可以编写自己
的
less
和greater than函数。不,简单
的
谷歌搜索并不能告诉你答案。 但是,
Python
语言中是否有像
std
::
less
和
std
::greater这样
的
预定义函数
浏览 12
提问于2019-09-04
得票数 0
回答已采纳
2
回答
标准库有比较器反转机制吗?
c++
、
templates
、
iterator
、
comparator
、
c++-standard-library
我知道标准库有,在给定迭代器类型
的
情况下,可以使用它来获得它
的
反向(类型)。 它是否也有类似的机制来逆转用于排序/排序
的
比较器?采用比较器类型并产生对应于反向顺序
的
比较器
的
东西(假设顺序是可逆
的
)?例如,
std
::reverse_comparator<
std
::greater<int>>等同于
std
::
less
<int>
浏览 2
提问于2017-01-27
得票数 3
回答已采纳
3
回答
在STL映射中插入类时出现“没有匹配
的
调用函数”错误
c++
、
dictionary
、
stl
、
std
我在C++中有一个STL映射,其中键是一个无符号整数,值是一个类,其构造函数是: //Some stuff在其他类
中
,我在头部声明了
std
::map:
std
::map<unsigned int, Foo> *m_mapFoo;m_mapFoo但是我在insert方法
中
得到了以下错误: no
浏览 2
提问于2012-11-20
得票数 9
回答已采纳
1
回答
SWIG将地图矢量转换为
python
字典列表
python
、
c++
、
swig
、
typemaps
嗨,我正在用SWIG包装C++,以便在
python
中使用。为了包装C++类,我使用了SWIG。我对类型映射没有很好
的
概念,因此我被卡住了。我有一个由多个地图组成
的
向量,即。
std
::vector<
std
::map<
std
::string,int>>和我想从C++函数
中
返回它,并将其转换为
python
中
的
字典列表。我在网上搜索了一下,但什么也没找到。/lib/wrapper.
浏览 7
提问于2020-09-02
得票数 1
2
回答
std
::对整数相等
的
排序行为
c++
、
sorting
、
std
当与相等
的
整数一起使用时,
std
::sort
的
行为是要让它们保持相同
的
顺序,还是只是做一些不可预测
的
事情?
浏览 0
提问于2010-11-05
得票数 11
回答已采纳
2
回答
是否有“requires”代替“void_t”?
c++
、
c++20
、
c++-concepts
void_t是检测某些表达式
的
可编译性
的
一个不错
的
黑客,但是我想知道是否有什么方法可以用requires (或requires )进行检查,因为从可读性
的
角度来看,我真的不喜欢void_t。理想情况下,我希望这是可行
的
,但它没有,可能是因为羔羊没有模板.requires(
std
::unordered_set<int> x) {x<x;} {};如果这种使用看起来很奇怪,我真正
的
动机是检查某些东西没有编译,例如,我
的
非模板类型没有
浏览 10
提问于2022-10-05
得票数 1
回答已采纳
1
回答
Solaris 5-10 CC编译器缺少符号错误会导致链接失败。
compiler-construction
、
compiler-errors
、
solaris
、
cc
不过,我
补充
了一些更明确
的
信息(我从昨天起了解到
的
),只出现在这篇文章
中
。#include <map>int main() { return 0; } 我想首先在这个文件上运行它们当然应该在各自
的
符
浏览 3
提问于2012-10-14
得票数 0
1
回答
委托条件
中
的
std
::
less
或
std
::greater
c++
::endl; }{ intersectionIn.insert(
std
::pair<CoordinateValue(1000,2000),12));
浏览 4
提问于2016-04-19
得票数 1
2
回答
当构造有
std
::
less
as参数时,对象类型看起来很奇怪
c++
、
visual-studio
如果我在a1上鼠标,它
的
类型是"A a1(
std
::
less
(*)())“,a2只显示"A a2”,这正是我所期望
的
。public: void foo() { } A a1(<em
浏览 4
提问于2014-04-27
得票数 0
回答已采纳
3
回答
C++:带有
std
库类型
的
花括号
c++
、
std
我试图理解
std
::
less
的
文档,下面给出了模板用法
的
示例。::
less
<int>{}(5, 5.6) << ' ' // false: 5 < 5 (warn: implicit conversion) <<
std
::
less<
浏览 4
提问于2022-07-11
得票数 1
回答已采纳
1
回答
使用折叠表达式为数组实现操作符
c++
、
c++17
、
fold-expression
我正在c++17
中
使用最新
的
clang++玩折叠表达式。我试着为数组实现
less
操作符,我想要将它用于固定大小
的
字符串。
std
::cout <<
less
(arr1, arr2) <<
std
::endl;
std
::c
浏览 2
提问于2015-07-07
得票数 6
回答已采纳
1
回答
枚举上
的
std
::
less
c++
、
enums
、
language-lawyer
该标准是否保证
std
::
less
<MyEnumType>将对MyEnumType进行排序,就好像MyEnumType
的
值被强制转换为大小合适
的
整数类型一样?
浏览 0
提问于2012-12-07
得票数 6
回答已采纳
1
回答
这个大括号
的
cpp语法是什么?
c++
、
syntax
唉,谷歌很难找到像大括号这样
的
符号。=
std
::
less
<>>{}int main()
std
::coutconversion)
浏览 4
提问于2022-04-28
得票数 0
回答已采纳
1
回答
/usr/bin/env:节点:没有这样
的
文件或目录,c++
c++
、
node.js
、
less
我安装了nodejs,
less
。我创建了一个较少
的
文件test.
less
a{color:@color;}lessc test.
less
test.css
std
::string shell_exec(
std
::string cmd )
std
::s
浏览 0
提问于2014-12-22
得票数 0
1
回答
为什么swig可以无缝地将
python
列表转换为
std
::vector而不是
std
::set?
swig
为了将基本
的
C++类扩展到
python
,我用swig做了一些试验。我发现了一种与使用集合有关
的
行为,到目前为止我无法解释。当我
的
扩展运行到
python
时,我
的
误解就开始了。,即
python
list of integers在内部转换为一个
std
::vector<int>。::set< int,
std
::
less
< int >,
std
::allocator< int
浏览 0
提问于2020-03-20
得票数 1
回答已采纳
1
回答
为什么这个模板类工作,尽管使用
std
::不那么奇怪
c++
、
c++-standard-library
此代码适用于:}template<class T> s
浏览 10
提问于2022-12-01
得票数 0
回答已采纳
1
回答
我不能在用较少比较器定义
的
映射中插入元素
c++
、
dictionary
、
comparator
我有以下地图:其中CustomClass是我用<运算符重载
的
类。但是我不能在这样
的
类
中
插入元素,当我使用以下代码时会得到一个错误:mp.insert(
std
::make_pair(1,
浏览 3
提问于2022-05-09
得票数 -1
2
回答
具有O(n * log(n))时间和O(1)空间复杂度
的
稳定比较排序
algorithm
、
sorting
、
complexity-theory
、
proof
在浏览时,我注意到没有一个稳定
的
具有O(n*log(n)) (最坏情况)时间复杂度和O(1) (最坏情况)空间复杂性。这看起来像一个理论边界,但我找不到更多关于它
的
信息。 如何证明这一点?注意:我知道比较排序
的
O(n*log(n))最坏情况时间复杂度
的
下限。
浏览 1
提问于2012-03-19
得票数 6
回答已采纳
2
回答
如何在macOS中使用(链接)调试版本
的
libc++?
c++
、
macos
、
clang
、
llvm
、
libc++
我想在macOS
中
启用libc++
的
调试版本,所以我在cxx_build_flags
中
定义了_LIBCPP_DEBUG=1,但是无法链接libc++
的
调试功能。我猜我
的
系统
中
只有libc++
的
发行版,那么如何在macOS
中
获得libc++
的
调试版"
std
::__1::__libcpp_db::__decrementab
浏览 4
提问于2018-03-27
得票数 4
3
回答
std
::
less
<char>
中
的
故障分割
c++
、
segmentation-fault
这会导致gdb回溯出现分段错误: #0 0x000000000040f043 in
std
::
less
<char>::operator() (this=0x622a40, __x=@0x623610,Identity<char>,
std
::
less
<char>,
std
::allocator<char> >::_M_lower_bound (this=0x622a40, __x=0x6235f0,<char>,
std
浏览 5
提问于2011-04-05
得票数 2
回答已采纳
点击加载更多
热门
标签
更多标签
云服务器
ICP备案
实时音视频
即时通信 IM
对象存储
活动推荐
运营活动
广告
关闭
领券