Skip to main content
How are we doing? Please help us improve Stack Overflow. Take our short survey
Filter by
Sorted by
Tagged with
-4 votes
1 answer
174 views

I am trying to overload the % operator in C++ to make it do division instead of modulo. For example, 5 % 4 should give me 1.25 after overloading. But I get "nan". Why? This is the code I ...
RAVINDRA DIVEKAR's user avatar
1 vote
1 answer
162 views

I want to redefine new and delete operators to use a custom allocator in a c++ project with multiple translation units. Here are the redefines written in the memops.hpp file: #pragma once #include &...
mdjukan's user avatar
  • 173
0 votes
1 answer
165 views

[Note: I'm stuck with C++17.] I have a class template that is instantiated over a fairly large number of types (~25). A few of them can correctly be converted among one another, and I would like to ...
chenel's user avatar
  • 43
3 votes
2 answers
197 views

According to what I know, the result value of an overloaded operator->() can be any type T provided that T is either a pointer type or it is a class/struct which also exposes an overloaded operator-...
Die4Toast's user avatar
  • 123
3 votes
2 answers
142 views

The member arrow operator is treated by the compiler in a special way. Since an overloaded arrow operator can have an arbitrary return type, several such operators from different classes may need to ...
Die4Toast's user avatar
  • 123
2 votes
3 answers
177 views

Im trying to define the spaceship operator for a simple template string class. namespace mylib { template <size_t N> struct String { String() { *data = '\...
Andreas0815's user avatar
7 votes
1 answer
175 views

My program after porting to Visual Studio shows some weird results. After reduction I came to this minimal reproducible example: consteval auto operator +( auto x, auto&& y ) { return x += ...
Fedor's user avatar
  • 24.7k
0 votes
1 answer
98 views

I am developing quite a large Class whose objects require relatively costly validation if they are created by the public constructors, but for which the validation can be dispensed with for private ...
jedynygucio's user avatar
2 votes
0 answers
88 views

Compile Silo and get the following error error: no match for ‘operator<<’ (operand types are ‘std::ostringstream’ {aka ‘std::__cxx11::basic_ostringstream<char>’} and ‘std::pair<const ...
Miya's user avatar
  • 29
0 votes
0 answers
85 views

I got a function: bool equal(int var, std::initializer_list<int> list) { return std::find(list.begin(), list.end(), var) != list.end(); } which works, I got no error when I use the function....
Alexandre Man's user avatar
-1 votes
1 answer
143 views

package test; public class Test { public static void main(String [] args) { int a = 10; int b = 12; System.out.println( ++a == 11 || b++ == 12); ...
Mustafa Quraishi's user avatar
3 votes
2 answers
128 views

In the program below, class A has a convert-to-int operator. Class B has a convert-to-A operator. While the compiler converts A to int implicitly, it fails to do so for converting B to A: class A { ...
modjtabaf's user avatar
-1 votes
1 answer
235 views

In .pxd file, I wrote _Point operator+(const _Point other) const _Point operator -(const _Point other) const bool operator==(const _Point other) const In .pyx file, I wrote def __eq__(...
Punreach Rany's user avatar
4 votes
1 answer
229 views

So I wanted to improve the noexcept of some operators and functions in my code can I mark this function noexcept ? std::string remove_suffix(/*passed by copy*/ std::string s) /*noexcept*/ // is ...
user avatar
1 vote
1 answer
60 views

It seems the operator 'in' on tuple won't only match the whole string if there is only one item in the tuple. The behavior is different from 'list' and 'set'. I don't understand where the difference ...
Alex Chen's user avatar
-10 votes
1 answer
83 views

In the image above, I get the value some new value as the output. Could somebody explain me why that is happening? I thought I would get test value as the output but it doesn't seems to be the case. ...
Dilip's user avatar
  • 131
1 vote
1 answer
150 views

I learn Swift and use Swift operators (https://developer.apple.com/documentation/swift/operator-declarations) and saw the operator "Pointwise Logical Not"(.!). I started Googling and came ...
koshe1ca's user avatar
0 votes
0 answers
23 views

enter image description here i tried to used operator istream and ostream but it doesn't work. I'm writing a HinhTron class from the existing Diem2D class to use point coordinates from the 2D class. ...
bazzi's user avatar
  • 1
0 votes
0 answers
50 views

I have a code that works like this: template<size_t size> struct myClass { public: std::array<uint8_t, size> bytes; bool operator==(const myClass<size>& o) const { ...
coin cheung's user avatar
  • 1,147
1 vote
1 answer
318 views

I have a calculated PowerShell variable that may be set to $True (Boolean), or 'True' (String), or $False (Boolean), or 'False' (String), and I want to test if it's "True" (Boolean or string)...
David Sitner's user avatar
0 votes
1 answer
965 views

Are these range operator and indexer? I have never seen them used like this [..h]. Line 6 in this code: public static void Main(string[] args) { int[] a ={1,2,3,4,5,6,7,8,9}; HashSet<int>...
user23569772's user avatar
-2 votes
1 answer
68 views

When I'm trying to overload operator<< for char and use it which std::cout something is wrong.During compilation I don't have any errors but when i type ./a.outi see Segmentation fault (core ...
Michael's user avatar
  • 79
2 votes
2 answers
123 views

Try to compile the following code. #include <string> #include <boost/any.hpp> class V { public: V& operator=(int i) { v = i; return *this; } V& operator=(...
user180574's user avatar
  • 6,244
0 votes
2 answers
167 views

I am receiving this error: main.cpp: In function ‘int main()’: main.cpp:14:36: error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream’ and ‘void’) 14 | std::cout << ...
nicocormier's user avatar
-1 votes
1 answer
63 views

Android WebView have trouble with emscripten generated code. When trying to load page, it complains = is unexpected in ||= string. ||= is logical OR operator with assignment. I am locking for ...
nintyfan's user avatar
  • 462
0 votes
1 answer
53 views

Trying to just copy one object array to a second array minus first item in array (which I don't believe should matter). (First array 33 items and 2nd array has 32). Nothing is copying over. 2nd array ...
Nat Broughton's user avatar
0 votes
0 answers
164 views

I got a C# class with a generic type. I'd like to have an implicit operator which converts an instance of this class to an instance of the same class with another generic type parameter. class MyClass&...
Daniel Schmid's user avatar
0 votes
0 answers
94 views

I'm using vs2022 and I'm confused about the c++ post-decrement operator overloading value passing, why does overloading a function that returns a value instead of a reference also affect the object ...
Lelly's user avatar
  • 1
4 votes
2 answers
118 views

Edit I remove some part of the question because it might be confusing > and thanks of answers I should be able to found out by myself. I am trying to write a program that resample a signal using a ...
Stéphane Guillaso's user avatar
2 votes
1 answer
101 views

I have a abstract base class having operator()(), operator and virtual operator()(...) methods. In derived class i am overriding the virtual method but i cannot call the opearator()() method. And i ...
Miroslav Krajcir's user avatar
-1 votes
2 answers
148 views

It is one of the simple operations and I do not understand why and I just save it, but this bothers me, so I want to understand why? int a = 2; int b = 4; int c = 10; a = b++; System.out.println(a); a ...
nezar morjan's user avatar
1 vote
1 answer
111 views

After upgrading to v9 in Mendix, one of our Java actions is causing an error. The error can be seen below: ERROR: operator does not exist: bigint = character varying Hint: No operator matches the ...
Sarah's user avatar
  • 11
2 votes
1 answer
36 views

I want to do a struct for boundedElements like number that has a max and min value. However I'm stuck on how to do this. Here is an example of a property. The setfield method is just a method to set a ...
LaLoutreCouillue's user avatar
0 votes
1 answer
187 views

I am attempting to connect Orion-LD to the MongoDB Community Operator in a Kubernetes (k8s) environment, but I am encountering the following error: time=Friday 06 Oct 15:25:17 2023.339Z | lvl=WARN | ...
Fabio Henrique Cabrini's user avatar
0 votes
1 answer
74 views

So, i'm having a hard time with this code i wrote. The way it should be working is switching the bool is_on variable between True and False, and while is_on is True, it keeps printing some text. ...
user avatar
0 votes
1 answer
35 views

This seem to be a recurrent error message but solutions seem to be rather case specific for what I'm seeing (I'm starting with R so every step is difficult for me still). I'm following the script for ...
Diego's user avatar
  • 1
0 votes
0 answers
73 views

I'm struggling to understand what the following command is checking. (a>b)||(a<b) I have defined a as 8 and b as 3. The returning result is TRUE. Is this checking whether a>b is true; or a ...
RStudent's user avatar
0 votes
1 answer
215 views

I'm migrating to Composer version 2.4.1 and AIrflow 2.5.3. Some DAGS that I use the BigQueryCreateExternalTableOperator are returning an error when creating the external table, I am passing the file ...
Gustavo Lima Monteiro's user avatar
-4 votes
2 answers
213 views

I'm making integer calculator using C++. Why is the following not working? #include <iostream> #include <string> using namespace std; class Number { int i; public: Number(int i) ...
Helpmeeeee's user avatar
0 votes
1 answer
139 views

I have an error in the code below if I make the strict option to ON but if I make it OFF then the error does not appear. How can I use without error with the strict option being on? Thanks Dim Invno ...
roy's user avatar
  • 729
1 vote
0 answers
67 views

I made overload for ostream operator<< for std::vector in namespace printable. As far as I understand, ADL will not see this overload implicitly, because std::vector is not a member of printable,...
Joshua Jakowlew's user avatar
2 votes
5 answers
4k views

I'm looking to find various ways that a packing / unpacking operator is implemented. As an example: *[1,2,3] --> 1,2,3 (one array scalar value unpacked to three values) *1,2,3 --> [1,...
David542's user avatar
  • 112k
0 votes
1 answer
546 views

I am trying to deploy bitnami/grafana-operator to AKS with persistence. I want to be able to create Dashboards in UI and they to be persistent. I am using Helm chart, where the persistence.enabled is ...
Borislav_source's user avatar
0 votes
3 answers
176 views

let num = 1 let st = 'data' console.log(typeof `${num}`, typeof `${st}`) the output of the first variable should be number but it's printing string when I am using string interpolation console....
Izza Ijaz's user avatar
0 votes
0 answers
60 views

#include <string.h> #include <vector> #include <iomanip> using namespace std; void JoinRows(double *C, double *A, int nrows, int ncols, double *B, int mcols); // Function to join ...
robertnathe's user avatar
0 votes
1 answer
180 views

I'm trying to run an IF ELSE statement in Airflow that involves delete and insert of dataset based on the what is the current month. I have tried to use BigQueryInsertJobOperator but it doesn't allow ...
Yen's user avatar
  • 1
0 votes
0 answers
90 views

I am a newbie to C programming. Now, I am trying to understand the topic "C Operator Precedence and Associativity". Especially, I would like to pay attention to the order of evaluation with ...
Daniel Bodyak's user avatar
0 votes
1 answer
46 views

I saw in previous questions that it is impossible to make a direct addition without a cast but... How do you explain that this following tip works? byte startValue = 2; byte addingValue1 = 7; byte ...
Zoharion's user avatar
-1 votes
1 answer
974 views

In JS, it's not clear if '0' is truthy or falsy. So, we have : Boolean('0') == true, because it's a non-empty string. But: ('0' == false) The brain-itching starts from here : (!'0' == false) And then ...
Nowan's user avatar
  • 33
0 votes
1 answer
42 views

int result1 = 10; result1 -= 5.5;// due to compound assignment this will not cause error and result will be 4 System.out.println(result1); int result2 = 10; result2 = (int) (result - ...
Vishal Sangole's user avatar

1
2 3 4 5
55