Assign: The list::assign() is a C++ function used to assign values to a list.

PHOTO EMBED

Tue Mar 09 2021 17:08:05 GMT+0000 (UTC)

Saved by @randomize_first #c++

int main(){
		// Initialization of list
	    std::list<int> demo_list;

	    // Assigning the value 100, 5 times
	    // to the list, list_demo.
	    demo_list.assign(5, 100);

	    // Displaying the list
	    for (int itr : demo_list) {
	        std::cout << itr << " ";
	    }

	    return 0;
	}
content_copyCOPY