Currently I'm creating a new set like this:
std::set<A> s;
s.insert(a1);
s.insert(a2);
s.insert(a3);
...
s.insert(a10);
Is there a way to create s
in one line?
Navigate to the Data pane, under Dimensions, right-click a field and select Create > Set. In the Create Set dialogue box, configure your set. You can configure your set using the following tabs; Use the General tab to select one or more values that will be considered when computing the set.
To create an empty set you have to use set(), not {}; the latter creates an empty dictionary, a data structure that we discuss in the next section.
There are two main methods to create sets. One is using the set function and the other is to use curly braces and add objects individually.
int myints[]= {10,20,30,40,50};
std::set<int> mySet(myints, myints + 5);
Ok, admittedly two lines :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With