I am a C programmer and new to C++.
I have used maps before and insertion often was like map.insert(std::make_pair(key, value))
.
Today I saw in someone's code and further on this website a simpler syntax:
map.insert({key, value})
The linked website says {k,v}
is a "pair" but does not explain how.
This would not have been a surprise in Javascript where braces denote objects and everything is dynamic. But when did C++ evolve to support such features.
I am looking for an explanation in terms of static typing and type coercion, how {k,v} is same as std::pair
Edit: This question has been marked as duplicate of this one but the answers to that question deal entirely with what is faster by checking assembly code. The answer I was looking for has been given by user spectras in comments as list initialization. Before anyone rushes to mark a question as duplicate, do check whether answers to the linked question answer what was asked.