python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
How to forward declare a template function in global or namespace with default argument?
template<typename T> void foo (T t, int i = 0); // declaration
int main () { foo(1, 0); } // error!!
template<typename T> void foo (T t, int i = 0) {} // definition
Above is a minimal ...
iammilind
Votes: 0
Answers: 1
Default arguments for member function of templated class
Let's say I have something like this bit of (duplicated) code that I'd like to refactor using a template:
#include <iostream>
#include <algorithm>
#include <set>
struct IntFoo {
a...
joao
Votes: 0
Answers: 1
In Python, how can I type hint a list with an empty default value?
I would like to make a function that looks like this, but I'm aware that default arguments should never be mutable:
def foo(req_list: list, opt_list: list = []):
...
Without type hinting, I know...
pbPy
Votes: 0
Answers: 1
What does this passage from cppreference.com (Default arguments) mean?
From cppreference page on default arguments:
Non-static class members are not allowed in default arguments (even if they are not evaluated), except when used to form a pointer-to-member or in a membe...
LandP
Votes: 0
Answers: 2