Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
在 C++ 中重载比较运算符会导致“无效运算符<”
目前正在尝试在 C 中对对象向量进行排序 每个对象都包含一个字符串 字符串可以包含字母或数字 由于设计限制 这是必要的 因为比较器可以更改 目前 该对象的类已重载 因此当比较两个对象时 将比较它们包含的字符串 这在一定程度上是有效的 但是
c
Sorting
operators
operatoroverloading
overloading
结构解引用运算符(运算符->)
我正在为迭代器编写一个薄模板包装器 在通过结构取消引用运算符时遇到了绊脚石 主要是因为指针没有 include
c
templates
Iterator
operatoroverloading
Python 中可以重载 from/import 吗?
Python 中是否可以重载 from import 语句 例如 假设jvm object是类的一个实例JVM 是否可以编写这样的代码 class JVM object def import func self cls return som
python
import
operatoroverloading
通用集合中的记录相等性
假设您有一条带有重载相等运算符的记录 TSomeRecord record Value String class operator Equal Left Right TSomeRecord Boolean end 实现比较字符串值 如果根据
Delphi
generics
operatoroverloading
delphixe2
record
size_t 参数新运算符
我心里有一个观点 我无法弄清楚新运算符重载 假设我有一个类 MyClass 但 MyClass h MyClass cpp 和 main cpp 文件如下 MyClass h class MyClass public Some member
c
operatoroverloading
newoperator
嵌套类模板的重载运算符<<
我有以下设置 template lt class T gt struct Foo struct Bar Bar const T t otherT t T otherT Foo const T t myT t T myT 现在 我想举例说明F
c
templates
operatoroverloading
friend
nestedclass
如何“覆盖”[] 以接受 C++ 中的两个参数?
我正在尝试在 C 中创建一个位向量类来对某些硬件进行建模 在我所知道的大多数 HDL 硬件描述语言 中 特定位的引用如下 my vector bit position 子向量的引用如下 my vector msb lsb or my vec
c
operatoroverloading
在运算符重载中使用可变参数模板是否合法?
我希望能够写一些这样的东西 struct bar template
c
templates
operatoroverloading
languagelawyer
variadictemplates
std::ostream 不能输出 const char 数组吗?
For the fun and experience of it I m modifying and exploring the source code for Blobby Volley 2 1 0 Linux 嗯 我would正在修改源
c
operatoroverloading
ostream
仅在与类的其他对象进行比较时,是否有任何理由不将运算符==重载为成员?
我一直在互联网上寻找答案 但找不到任何答案 给出的唯一原因似乎与不同类型的对象进行比较有关 例如MyClass int 但最常见的用例是将类实例与同一类的另一个实例进行比较 而不是与任何不相关的类型进行比较 换句话说 我确实理解以下问题 s
c
operatoroverloading
重载 *、+、-'vector
类的运算符
我正在编写一个 Line 类来创建数值方法 我想要这些运算符 使我的代码更具可读性和更容易理解 include
c
class
operatoroverloading
stdvector
数值向量运算符重载+右值引用参数
我有下面的数值向量模板类 用于数值计算的向量 我正在努力让它成为可能D A B C所有变量都是Vector对象 A B and C不应修改 我的想法是使用Vector operator Vector B 这样在 希望 Rvalue 之后Ve
c
operatoroverloading
numerical
rvaluereference
将对象与左侧的常量相乘
我有一个Matrix类并且它已经超载了 用于标量和矩阵乘法的运算符 template
c
templates
operatoroverloading
memberfunctions
nonmemberfunctions
Python:重载特定类型的运算符
我希望能够让我的类的运算符以我定义的方式与常规类型进行交互 比方说 我有 class Mynum object def init self x self x x def add self other return self x other
python
operatoroverloading
“friend”函数和 << 运算符重载:为类重载运算符的正确方法是什么?
在我正在进行的一个项目中 我有一个Score类 定义如下score h 我试图超载它 所以 当 lt lt 对其进行操作 points name被打印 这是我尝试做的 ostream Score operator lt lt ostream
c
class
operatoroverloading
friend
friendclass
VB.Net Power 运算符 (^) 从 C# 重载
我正在编写一个暴露给 VB Net 的 C 类 我想重载vb net 运算符 这样我就可以写 Dim c as MyClass Set c New Dim d as MyClass Set d c 2 在 C 中 运算符是xor运算符和幂运
c
VBNET
operatoroverloading
operatorkeyword
按值重载运算符会导致使用移动的值
编译以下使用运算符重载的 Rust 代码 use std ops Add derive Show struct Point x int y int impl Add for Point type Output Point fn add se
copy
operatoroverloading
Rust
passbyvalue
ownership
C# 中的运算符重载
class Point private int m PointX private int m PointY public Point int x int y m PointX x m PointY y public static Point
c
operatoroverloading
在抽象基类中重载运算符的正确方法是什么?
假设我有一个抽象基类 它只定义一个可以执行加法的容器 class Base public virtual Base virtual Base operator const Base rhs 0 然后我希望 Base 的子类提供实际操作 cl
c
operatoroverloading
polymorphism
abstractclass
运算符 new[] 不接收额外字节
我有这样的代码 include
c
operatoroverloading
newoperator
destructor
«
1 ...
10
11
12
13
14
15
16
»