Hey guys,
Let's say I have those two functions:
void Foo(std::string String);
void Foo(std::vector<std::string> Strings);
How do I call the second one by creating the vector on function call?
I'm asking because sometime does Foo({"One", "Two"}) work and sometimes it can't find a matching function prototype. And (sometimes?) does Foo(("One", "Two")) work.
What is the correct way to call such a function?
How is this implicit object creation called?
And how would it look like if I would create the object explicitly (although I want to keep it short if possible)?
I.e. which braces would I need to use?
Foo(std::vector<std::string>{"One", "Two"}) ?
Or is there even another way?
Because I know that it is also (sometimes?) possible to create objects like this:
Object o = Object(1, 2);
And sometimes but now always like this:
Object o(1, 2);
So many possibilities and sometimes some of them don't work, although I don't see why, so I just check multiple syntaxes until the compiler is okay with it.