Make_pair equivalent in Julia?

Is there anything equivalent in Julia to do make_pair on vectors, like in c++?

Example:

vec[r].insert(std::make_pair(i,j));

Best regards

In Julia, you can create a Pair with the => syntax, i.e. i => j creates a pair whose first element is i and whose second element is j. You can also just use the Pair constructor directly as Pair(i, j), which does exactly the same thing.

2 Likes

Thank you so much for the quick response!
I would like to be able to insert this structure into an array, is it possible? Like inserting a pair in a vector, as in c++

yeah of course, push!(), but remember, it may not be the best approach to direct translate C++ code

3 Likes