Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
37 views

I've got a really confusing error, when I tried to implement overloaded functions as a type instead of regular functions syntax. Here is the code: function date(value: string, format: 'numeric'): ...
Yes Man's user avatar
  • 359
7 votes
2 answers
731 views

Assuming two overloads: void X::f(int, float); void X::f(long, double); is it possible, in C++17 or higher, to infer int/long (or whatever it is) from float/double for the second argument? To be used ...
Gleb Belov's user avatar
4 votes
0 answers
166 views

Here's a snippet that does not depend on any external includes, and behaves differently on msvc/gcc/clang. I left two alternatives inside main. It compiles with gcc on both alternatives; does not ...
Powereleven 's user avatar
3 votes
1 answer
66 views

I'm using typescript in a project which uses BackboneJS and in a certain case, a method overload gets lost. I narrowed it down to this case: class Model { set<A extends string>(key: A, value: ...
Sjaak Voz's user avatar
0 votes
0 answers
87 views

Getting the following error when i am trying to sign in with my jwt. No overload matches this call. Overload 1 of 5, '(payload: string | object | Buffer<ArrayBufferLike>, secretOrPrivateKey: ...
Shivain Sharma's user avatar
0 votes
0 answers
35 views

I'm new to both stackoverflow & typescript and I'm quite confused about the concept of compatibility check in function overloading of typescript. function foo<A, B>(fn: (a: A, b: B) => A, ...
Goonco's user avatar
  • 1
-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
0 votes
1 answer
130 views

I'm trying to overload a method with singledispatchmethod. It works great for simple types like int and str, but for different types of nested lists like list[int] or list[str], this breaks with the ...
itamar kanter's user avatar
0 votes
2 answers
110 views

I'm trying to extend a fixture: that means not only overriding, but partially reusing the old one. For example, in the code below the fixture Test.values uses the fixture values and concatenates lists ...
Dmitry Kuzminov's user avatar
19 votes
2 answers
1k views

The following class has four overloads of function f. When T!=int, all overloads have unique parameter lists, but when T=int, all overloads have the same parameter lists. To make it compile even when ...
Sven Sandberg's user avatar
-3 votes
1 answer
75 views

I have a general parent class class Sensor(): def writeCarac(self,uuid,PAYLOAD=None): pass def OTAReset(self): self.writeCarac(0x1234,[1,2,3,4]) and a child class class ...
proff's user avatar
  • 19
4 votes
1 answer
167 views

I've have a load of function overloads, mainly consisting of two signatures: void func(const my_type1&); void func(const my_type2&, hash_t); and a function that tries to call func based on ...
Biggy Smith's user avatar
1 vote
1 answer
98 views

I am learning oop in Fortran. And I wonder about the interest of overloading type bound procedure when the type of an argument is not known at compile time. Let me explain, step by step my problem (...
Stef1611's user avatar
  • 2,515
4 votes
1 answer
116 views

I am using Java 8 and facing some weird error. The compiler gives the following error: error: reference to [method] is ambiguous Here's my code StringBuilder sb = new StringBuilder(); Stack<...
bloop's user avatar
  • 43
2 votes
1 answer
87 views

My overload method is overloaded with 4 different functional interfaces. I have 3 examples in which I call this overloaded method with a lambda that is compatible with 2 of those functional interfaces....
Skifozoa's user avatar
  • 323
1 vote
1 answer
101 views

As a learning exercise, I'm trying to test some F# code using MSTEST. I've run into a problem that is driving me crazy, not because I can't work around it, but because I don't understand how to ...
John Christopher Linstrum's user avatar
0 votes
0 answers
73 views

I have this code, the parent class has an abstract bool Filter(EntityComponent entity) but in this class, I prefer implementing bool Filter(BaseComponent entity) because others are calling the latter ...
Luke Vo's user avatar
  • 21.6k
0 votes
1 answer
86 views

I'm trying to create a function that connects to the database and queries for car details. I need the function to have 3 overloads, the first overload returns the basic car details that exist in the ...
Abdulkerim Awad's user avatar
2 votes
2 answers
141 views

This returns an array with only one element and thus throws an exception. But it works when I omit StringSplitOptions.TrimEntries. using System; public class Program { public ...
codymanix's user avatar
  • 29.6k
2 votes
2 answers
155 views

Is there a std::max() overload or a simple way to clamp a size_t expression to a size_t constant, without doing static_cast<size_t>(10) ? The call below does not compile because 10 is not a ...
patraulea's user avatar
  • 986
1 vote
0 answers
120 views

I think this is a bug in mypy but I'm not sure: from typing import overload, NamedTuple class A(NamedTuple): pass class B(NamedTuple): pass @overload def frobnicate(arg: A) -> A: ... @...
mqnc's user avatar
  • 766
1 vote
1 answer
112 views

First of all, some demo code: #include <format> #include <iostream> // OVERLOAD 1 template <typename... Ts> inline void write(const std::format_string<Ts...> &fmtStr, Ts &...
Braaedy's user avatar
  • 560
-2 votes
1 answer
99 views

I want to write a function of one argument with multiple overloads for different integer types. It want to be able to call it both with types of implementation-defined size (signed char, shot, int, ...
Andrey Bienkowski's user avatar
11 votes
1 answer
556 views

Question- see Compiler Explorer If I create an std::vector<int> and initialize it two ways, both call the std::initializer_list constructor. std::vector<int> v1{1, 2, 3}; // Calls ...
Josh Shields's user avatar
2 votes
2 answers
93 views

I have a function that I'd like to take numpy arrays or floats as input. I want to keep doing an operation until some measure of error is less than a threshold. A simple example would be the ...
Joel's user avatar
  • 24k
0 votes
1 answer
283 views

I'm trying to build a matrix class using a template. I understand that for operator<< to work, it needs to be declared outside of the class, and then declared as a friend function. When I do ...
Ella's user avatar
  • 35
0 votes
0 answers
85 views

The following piece of code compiles fine #include <iostream> #include <map> #include <memory> using namespace std; class child { public: child(std::string name,uint32_t ...
KPathak's user avatar
  • 49
1 vote
0 answers
44 views

I have this code perfectly working on clang template <template <typename, typename> typename T> struct CollectIntoAllocatedContainer { // ... }; template <template <typename, ...
burbokop's user avatar
2 votes
1 answer
61 views

I'm facing an compilation issues with sc_dt::sc_biguint data types. I tried to reproduce the issue with a simple example below #include<iostream> #include<systemc.h> using namespace std; ...
KPathak's user avatar
  • 49
4 votes
1 answer
255 views

Although the method signature in Sub is compatible with Super, mypy rejects the override: Signature of "method" incompatible with supertype "Super". I'm using python 3.13.1 mypy 1....
平田智剛's user avatar
0 votes
0 answers
71 views

I have an inheritance chain: class Base {}; class Derived : public Base {}; In my interface, I define methods with the same name taking each one of the above classes: class Interface { public: ...
dEmigOd's user avatar
  • 640
0 votes
0 answers
72 views

Fluent-bit is compiled under linux (Ubuntu 24.04 LTS) from source (tag v3.2.2) Using a C-compiler (gcc) test program compiles fine Using g++ I get compile errors from mpack.h complaining about ...
Peter Brødsgaard Christiansen's user avatar
0 votes
1 answer
46 views

I have this playground and I want to make it works in my case. type Person = { name: string; surname: string; } type User = Person & { username: string; } type Name = string; function ...
Fiodorov Andrei's user avatar
1 vote
1 answer
46 views

I am trying to create a function overload for an API call with a delete method. Here's what I have so far: type ApiCore = { endpoint: string; key: string }; export type ApiParams = { routeParam?: ...
Echo's user avatar
  • 641
1 vote
1 answer
77 views

I need to pass pointers to member functions as parameters to other functions. I use std::mem_fn to wrap those in function objects. Sometimes the member functions have overloads. I learned two syntax ...
Sven Sandberg's user avatar
0 votes
1 answer
100 views

My code is using a library called "tf2" and it has a namespace of tf2 and overloaded functions like tf2:fromMsg(). Then in my code, I would like to add one more overloaded function tf2:...
Felix F Xu's user avatar
-4 votes
1 answer
93 views

My realization have program then I try to += with empty initial string. I have the empty constructor = default. Before I try something like: str = ""; sz = 0; This is also don't work. My ...
lilof's user avatar
  • 15
0 votes
1 answer
418 views

Is it possible to extend existing type hints for a Python package in my application code (i.e., not touching the upstream type hints) by adding custom overload for a method? (See also repo with ...
dlukes's user avatar
  • 1,873
0 votes
0 answers
32 views

I want to zip dictionaries into keys to tuples of values. I would be happy to annotate only for specific number of arguments, I will only use up to 5 ever. from typing import Optional, Tuple, overload,...
KamilCuk's user avatar
  • 146k
5 votes
3 answers
163 views

The following functions have all a different signature. I would expect the functions which have a callable which again has a Base& and one that has a Derived& to be different. Although they ...
Joel's user avatar
  • 1,777
1 vote
3 answers
168 views

I'm developing an API looking like GLib logging. My API can also disable these functions when the flag -DDEBUG isn't passed to GCC. That means, there are no residues in the binary, all these debug ...
Eternal Dreamer's user avatar
0 votes
1 answer
80 views

I knew that java will call the best match method if there are multiple methods matched. Refer to the code below, is it possible to force call non-the best match method without modifying method ...
xmcx's user avatar
  • 356
1 vote
2 answers
39 views

I have a function fun foo( id: String, vararg values: Int, ){ ... } and there are calls like these fun bar1(){ foo("id_1") foo("id_2", 1) foo("id_3&...
gstackoverflow's user avatar
-1 votes
1 answer
134 views

I want to provide synchronous version of my asynchronous function, but I can't over load, the function have structure like this. Who can explain, why I can't, and is there any other way to overload ...
Sevak Tadevosyan's user avatar
1 vote
1 answer
131 views

I am working on a C++ project involving class inheritance and function parameter overloading. I have two base classes that should never be instantiated but only inherited (by design choice): #include &...
Ahmad Othman's user avatar
0 votes
0 answers
66 views

I would like to compare 2 strings, with syntax either ^([A-Z]\d{2}![A-Z]{2}\d|[A-Z]{3})$ or ^\d{3}$ respectively for both strings with 2 different extension methods but with an identical name IsHigher(...
Ludovic Wagner's user avatar
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
0 votes
1 answer
112 views

I use the SFML graphic framework to make a very small 2D game engine. Recently, I tried to convert the engine from a static library to a dynamic library, but a problem occurs. It seems like a class ...
J3hud's user avatar
  • 13
0 votes
0 answers
74 views

In the following code, when calling arr.begin() on a const Array<10> object, it fails to find the const function Accessor::begin() const, and instead only tries MutableAccessor::begin() and ...
tmlen's user avatar
  • 9,230
1 vote
2 answers
104 views

I have a list of header files which I want to compile at once using Makefile. Some of them, however, have an externally defined function in assembly. If that is the case, there is a file with the same ...
lobelk's user avatar
  • 531

1
2 3 4 5
140