MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / vectorSnippet

Method vectorSnippet

Tests/Libraries/Containers/VectorTest.cpp:796–810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

794}
795
796bool SC::VectorTest::vectorSnippet()
797{
798 Console console;
799 //! [VectorSnippet]
800 Vector<int> myVector;
801 SC_TRY(myVector.reserve(10));
802 SC_TRY(myVector.push_back(1));
803 console.print("[0]={}", myVector[0]);
804 SC_TRY(myVector.push_back(2));
805 SC_TRY(myVector.pop_back());
806 SC_TRY(myVector.pop_front());
807 console.print("Vector<int> is {}", myVector.isEmpty() ? "empty" : "not empty");
808 //! [VectorSnippet]
809 return true;
810}
811
812namespace SC
813{

Callers

nothing calls this directly

Calls 5

reserveMethod · 0.80
printMethod · 0.80
pop_backMethod · 0.80
push_backMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected