Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class Set
Note: This documentation is automatically generated.
Method |
AddElement | Return type: Set Arguments: int n Returns a set equal to the calling object, with element n added.
If n is already in the set, no operation occurs.
|
begin | Return type: ElementIterator<Set> STL iterator-related member functions.
|
Cardinality | Return type: int Returns the number of elements in the set. Uses the 32-bit version for
types that have 32-bits or less. Specialized for uint64_t.
|
Contains | Return type: bool Arguments: int n Returns true if the calling set contains element n.
|
ElementRank | Return type: int Arguments: int n Returns the rank of an element in a set. For the set 11100, ElementRank(4)
would return 2. (Ranks start at zero).
|
end | Return type: ElementIterator<Set> |
FullSet | Return type: static Set Arguments: Integer card |
Includes | Return type: bool Arguments: Set other Returns true if 'other' is included in the calling set.
|
RemoveElement | Return type: Set Arguments: int n Returns a set equal to the calling object, with element n removed.
If n is not in the set, no operation occurs.
|
RemoveSmallestElement | Return type: Set Returns a set equal to the calling object, with its smallest
element removed.
|
Set | Return type: explicit Arguments: Integer n Construct a set from an Integer.
|
Singleton | Return type: static Set Arguments: Integer n Returns the singleton set with 'n' as its only element.
|
SingletonRank | Return type: int Arguments: Set singleton Returns the rank of the singleton's element in the calling Set.
|
SmallestElement | Return type: int Returns the index of the smallest element in the set. Uses the 32-bit
version for types that have 32-bits or less. Specialized for uint64_t.
|
SmallestSingleton | Return type: Set Returns the set consisting of the smallest element of the calling object.
|
value | Return type: Integer Returns the integer corresponding to the set.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-06 UTC.
[null,null,["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eSet\u003c/code\u003e class in C++ provides methods for managing sets of elements, including adding, removing, and checking for membership.\u003c/p\u003e\n"],["\u003cp\u003eKey functionalities include determining cardinality, identifying the smallest element, and checking for inclusion of other sets.\u003c/p\u003e\n"],["\u003cp\u003eMethods like \u003ccode\u003eElementRank\u003c/code\u003e and \u003ccode\u003eSingletonRank\u003c/code\u003e allow for working with element rankings within sets.\u003c/p\u003e\n"],["\u003cp\u003eSTL iterator-related member functions \u003ccode\u003ebegin\u003c/code\u003e and \u003ccode\u003eend\u003c/code\u003e are available for set traversal.\u003c/p\u003e\n"],["\u003cp\u003eSpecialized constructors such as \u003ccode\u003eFullSet\u003c/code\u003e and \u003ccode\u003eSingleton\u003c/code\u003e facilitate the creation of specific types of sets.\u003c/p\u003e\n"]]],[],null,["# Set\n\nC++ Reference: class Set\n========================\n\n\nNote: This documentation is automatically generated.\n\n| Method ||\n|---------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`AddElement`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L156) | Return type: `Set ` Arguments: `int n` Returns a set equal to the calling object, with element n added. If n is already in the set, no operation occurs. |\n| [`begin`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L199) | Return type: `ElementIterator\u003cSet\u003e ` STL iterator-related member functions. |\n| [`Cardinality`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L172) | Return type: `int ` Returns the number of elements in the set. Uses the 32-bit version for types that have 32-bits or less. Specialized for uint64_t. |\n| [`Contains`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L163) | Return type: `bool ` Arguments: `int n` Returns true if the calling set contains element n. |\n| [`ElementRank`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L184) | Return type: `int ` Arguments: `int n` Returns the rank of an element in a set. For the set 11100, ElementRank(4) would return 2. (Ranks start at zero). |\n| [`end`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L202) | Return type: `ElementIterator\u003cSet\u003e ` \u003cbr /\u003e |\n| [`FullSet`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L147) | Return type: `static Set ` Arguments: `Integer card` \u003cbr /\u003e |\n| [`Includes`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L166) | Return type: `bool ` Arguments: `Set other` Returns true if 'other' is included in the calling set. |\n| [`RemoveElement`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L160) | Return type: `Set ` Arguments: `int n` Returns a set equal to the calling object, with element n removed. If n is not in the set, no operation occurs. |\n| [`RemoveSmallestElement`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L180) | Return type: `Set ` Returns a set equal to the calling object, with its smallest element removed. |\n| [`Set`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L139) | Return type: `explicit ` Arguments: `Integer n` Construct a set from an Integer. |\n| [`Singleton`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L152) | Return type: `static Set ` Arguments: `Integer n` Returns the singleton set with 'n' as its only element. |\n| [`SingletonRank`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L193) | Return type: `int ` Arguments: `Set singleton` Returns the rank of the singleton's element in the calling Set. |\n| [`SmallestElement`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L176) | Return type: `int ` Returns the index of the smallest element in the set. Uses the 32-bit version for types that have 32-bits or less. Specialized for uint64_t. |\n| [`SmallestSingleton`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L190) | Return type: `Set ` Returns the set consisting of the smallest element of the calling object. |\n| [`value`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L145) | Return type: `Integer ` Returns the integer corresponding to the set. |"]]