Horje
get first element of set c++ Code Example
how to get last element of set in c++
set<int> s = {1,2,3}
auto it = s.end();
it--;
cout<<*it<<"\n"; // This refers to last element of a set
access first value in a set c++
auto firstElement = *(mySet.begin()); // will return the first set<int>
get first element of set c++
set<int> st {1,2,3,4};

auto first (st.begin()); //get iterator of the first element
cout << *first << endl; //get the value from the iterator

// instead we could directly use :
cout << *(st.begin()) << endl;




Cpp

Related
transform c++ Code Example transform c++ Code Example
climits in cpp Code Example climits in cpp Code Example
vector with initial size Code Example vector with initial size Code Example
check if a variable is tring c++ Code Example check if a variable is tring c++ Code Example
break input stream into words Code Example break input stream into words Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8