Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 447 Bytes

emplace.md

File metadata and controls

16 lines (12 loc) · 447 Bytes

emplace

Description: Places an element in the vector at the specified position

Example:

    //creating a vector of 5 elements
    std::vector<int> vector1{10, 20, 30, 40, 50};

    //function to add an element at the beginning and the end
    vector1.emplace(vector1.begin(), -10);
    vector1.emplace(vector1.end(), 60);

See Sample Code Run Code