695 questions
17
votes
2
answers
870
views
Rationale of variadicity of std::function_ref
Whereas:
std::function has a single type, i.e template <typename Sig> std::function<Sig>;
std::function_ref is variadic, i.e template< class...> class function_ref; (and all ...
5
votes
1
answer
78
views
Trying to print a number in MacOS ARM Assembly (M3 Chip)
I'm brand new to Assembly, and I'm trying to figure out how to get my fibonacci program to work. However, it only prints 0's, no matter what I put in the x1 register. What am I doing wrong (or ...
3
votes
1
answer
106
views
Why is it not possible to extend a function call expression returning multiple values with another value on the right in Lua
Consider this test case.
function test()
return 1, 2, 3
end
-- OK: prints 4 1 2 3
print (4, test())
-- NOT OK: prints 1 4
print (test(), 4)
Why do values returned from a function in a function ...
0
votes
0
answers
54
views
How to convert a pack of std::vector to a pack of std::span through a variadic template function?
I would like to convert an arbitrary number of std::vector<T> to the same number of std::span through a variadic function template. I tried (almost) all the combinations, still it does not ...
3
votes
2
answers
184
views
How do I achieve *recursive variadic generic property inference* for siblings of an object/record?
I want to have the default property correctly infer the ArkType Type from the schema property, infinitely deep and infinitely wide. Accomplishing simple inference was easy... with the use of a ...
4
votes
2
answers
114
views
Variadic arguments vs. upcasting arguments
The overloaded variadic version of a function is supposed to have the lowest priority, when the compiler chooses a template specialization. However, this is not the case when a function argument has ...
0
votes
3
answers
173
views
How to properly forward non template, variadic arguments in C/C++ under MSVC
I am trying to forward non-template variadic arguments between two functions. None of those functions is mine so I can't change their signatures. I used va_args for that purpose but (unluckily) my ...
-1
votes
3
answers
169
views
How do I pass different data types in a variadic function, with parameter folds?
Edit: Reformatting the entire question
Making a Linked List lib, and I wanted to pass through multiple values in order to make the appending of items easier, so I created some Variadic Functions, ...
2
votes
2
answers
105
views
C++17: explicit first template parameter before variadic template
I am trying to write a generic class for a symmetric bloc matrix of arbitrary dimension. Only the upper triangular part is given:
A B C
D E
F
so the number of blocks is n*(n+1)/2 where n is the ...
1
vote
1
answer
258
views
Type Parameter Packs: how to return a tuple instead of an array?
To begin with I have this code, which works totally fine:
protocol ComponentAccessible {}
extension ComponentAccessible {
func components<each T>(_ keyPaths: repeat KeyPath<Self, each T&...
0
votes
2
answers
111
views
Convert `(String, Int)...` variadic parameter function to Dictionary for ExpressibleByDictionaryLiteral
I have objects that are currently initialized via one-parameter init functions that take an Array or Dictionary.
I've realized that I can use ExpressibleByArrayLiteral and ...
3
votes
1
answer
90
views
Confusion about type deduction in variadic templates
I have a class with multiple constructors, one being variadic and one taking an additional callable before the variadic arguments. However, the objects I create result in overload resolutions I dont ...
1
vote
4
answers
394
views
Variadic function pointer in C
I want to implement a function that take a function and its arguments then call it.
I have search a lot and could not implement it with variadic function.
I want a clean way to record stdio after ...
1
vote
1
answer
483
views
Variadic Generics vs. Value and Type Parameter Packs in Swift
There are two evolution proposals:
Variadic Generics and Value and Type Parameter Packs.
So... what is the difference? They feel conceptually very similar.
The second one, with super heavy syntax, is ...
0
votes
2
answers
365
views
"some" keyword with variadic parameter in Swift
protocol myProtocol {}
func doSomething(with params: (some myProtocol)...) {
// Implementation goes here
}
extension Int: myProtocol {}
doSomething(with: 1, 2, 3)
Compilation error at the func ...