As @DeiDei writes, C++17 includes template argument deduction for classes, so you can now write:
std::pair p (foo, bar);
std::array arr = { 1, 2, 3, 4, 5 };
and so on. But there are some (somewhat subtle) remaining use cases where make_pair
or make_array
can be useful, and you can read about them in: Usefulness of std::make_pair and std::make_tuple in C++1z
@Ruslan correctly notes in a comment that the above is mostly useful when the type of the elements is "obvious" to the compiler, or made explicit for each element. If you want to implicitly construct elements of some type, the above looks like;
std::array arr = { MyType{1,2}, MyType{3,4}, MyType{5,6}, MyType{7,8} };
which is too wordy; and that's one of the cases where you fall back on:
std::make_array<MyType>{ {1,2}, {3,4}, {5,6}, {7,8} };
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…