System.Set.operator -=
C++
Set& __fastcall operator -=(const Set& rhs) //Difference
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
function | public | sysset.h | System | Set |
説明
Set オブジェクトに、オブジェクト自身のデータを、rhs で指定された Set オブジェクトのデータ間の差を割り当てます。
operator -= は、論理演算 xor を、両 Set オブジェクトからのデータに対して実行します。
例:
この点を明確にするために、次の例を考えてみましょう。
#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 2 = eiSound;
2 -= vowels;
if (2 == (Alphabet() << 'h' << 'j' << 'k')) {
std::cout <<
"The erence of eiSound and vowels (as a result of the logical XOR operation) contains 'h', 'j', and 'k'\n";
}
else {
std::cout << "The erence operation failed.\n";
}
std::cout << "Press any key + ENTER to exit\n";
char ch;
std::cin.get(ch);
}