So let's say we have the following code:
#include <stack>
template<class... Args>
auto make_stack(Args&&... args)
{
std::stack<INSERT_TYPE_HERE> s;
return s;
}
int main()
{
auto s = make_stack(1, 2.2, 3); //would be std::stack<double>
auto s2 = make_stack(1l, 2, 3); //would be std::stack<long>
}
How would I find the common type of the arguments in the parameter pack?
Aucun commentaire:
Enregistrer un commentaire