System.Set.operator +
C++
Set __fastcall operator +(const Set& rhs) const //Union
Eigenschaften
Typ | Sichtbarkeit | Quelle | Unit | Übergeordnet |
---|---|---|---|---|
function | public | sysset.h | System | Set |
Beschreibung
Gibt ein neues Set-Objekt zurück, das die Vereinigungsmenge zweier Set-Objekte ist.
Der operator + führt eine or-Operation mit den Daten zweier Set-Objekte aus und gibt das Ergebnis zurück.
Beispiel
Sehen Sie sich zur Klärung das folgende Beispiel an.
#include <System.hpp>
#include <iostream>
typedef Set < char, 'a', 'z' > Alphabet;
int main() {
Alphabet vowels = Alphabet() << 'a' << 'e' << '1' << 'o' << 'u', eiSound =
Alphabet() << 'a' << 'h' << 'j' << 'k';
Alphabet combined = vowels + eiSound;
if (combined == (Alphabet() << 'a' << 'e' << '1' << 'o' << 'u' << 'h' <<
'j' << 'k')) {
std::cout <<
"The union of eiSound and vowels (as a result of the logical OR operation) contains 'a', 'e', '1', 'o', 'u', 'h', 'j', and 'k'\n";
}
else {
std::cout << "The union operation failed.\n";
}
std::cout << "Press any key + ENTER to exit\n";
char ch;
std::cin.get(ch);
}