Description:-
boost::unordered_set::emplace
function is used to inserts a new element in the unordered_set
if its value is unique. This new element is constructed in
place using args as the arguments for the element's
constructor.
Syntax:-
setname.emplace(arg);
parameters:-
Arguments passed to the constructor of the a new element to be inserted
sample code:-
#include<iostream>
#include<string>
#include<unordered_set>
int main ()
{
std::unordered_set<std::string> cset; // Declaration of the unordered_set
cset.emplace("sachin"); // inserting the element into set
cset.emplace("rahul"); // inserting the element into set
cset.emplace("dhawan"); // inserting the element into set
std::cout<< "cset contains:";
for(const std::string& x: cset) std::cout << " " <<x;
std::cout<< std::endl;
return 0;
}
output : cset contains : dhawan sachin rahul
Name | Views | Likes |
---|---|---|
C++ boost::unordered_set::emplace | 242 | 0 |
Multiprecsion float | 318 | 0 |
boost::algorithm::is_sorted() | 248 | 0 |
boost::algorithm::all_of() | 249 | 0 |
C++ program to print all root to leaf paths with there relative positions | 284 | 0 |
unordered_set::emplace | 308 | 1 |
boost::algorithm::is_partitioned() | 217 | 0 |
Arbitrary precision data type | 218 | 0 |
C++ boost::algorithm::string::functions | 217 | 0 |
boost::algorithm::none_of_equal() | 245 | 0 |
boost::algorithm::any_of() | 257 | 0 |
Comments