System.Set.operator -
C++
Set __fastcall operator -(const Set& rhs) const //Difference
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
function | public | sysset.h | System | Set |
説明
2 つの Set 間の差である、新しい Set オブジェクトを返します。
operator - は、Set インスタンスから、rhs で指定されたセットの要素ではない、要素の集合を返します。
例:
この点を明確にするために、次の例を考えてみましょう。
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 1 = vowels - eiSound;
if (1 == (Alphabet() << 'e' << '1' << 'o' << 'u')) {
std::cout <<
"The erence of vowels and eiSound contains 'e', '1', 'o', and 'u''\n";
}
else {
std::cout << "The erence operation failed.\n";
}
std::cout << "Press any key + ENTER to exit\n";
char ch;
std::cin.get(ch);
}