For the life of me I can't seem to create a temporary of this class, why isn't it allowing me to?
template <typename T>
struct Dog
{
Dog(T t) : tag(t) {}
T tag;
};
int main()
{
int tag = 6;
Dog<int>(6); // Works fine
Dog<int>(tag); // On Visual Studio I get no default constructor exists for class Dog<int>
// On onlineGDB I get error: no matching function for call to ‘Dog::Dog()’
}
Also, what's the difference here, again between rvalue and lvalue:
Dog(6); // Deduces fine
Dog(tag); // Deduction fail, error: missing template arguments before ‘(’ token
Also:
Dog<int>{tag}; // Works.
I take it because this is aggregate initialization?