operator<= <regex>

更新 : 2007 年 11 月

各種オブジェクトの大小関係 (以下) を比較します。

template<class BidIt>
    bool operator<=(const sub_match<BidIt>& left,
        const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
    bool operator<=(
        const basic_string<typename iterator_traits<BidIt>::value_type, IOtraits, Alloc>& left,
        const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
    bool operator<=(const sub_match<BidIt>& left,
        const basic_string<typename iterator_traits<BidIt>::value_type, IOtraits, Alloc>& right);
template<class BidIt>
    bool operator<=(const typename iterator_traits<BidIt>::value_type *left,
        const sub_match<BidIt>& right);
template<class BidIt>
    bool operator<=(const sub_match<BidIt>& left,
        const typename iterator_traits<BidIt>::value_type *right);
template<class BidIt>
    bool operator<=(const typename iterator_traits<BidIt>::value_type& left,
        const sub_match<BidIt>& right);
template<class BidIt>
    bool operator<=(const sub_match<BidIt>& left,
        const typename iterator_traits<BidIt>::value_type& right);

パラメータ

  • BidIt
    反復子の型。

  • IOtraits
    文字列の特徴 (traits) クラス。

  • Alloc
    アロケータ クラス。

  • left
    比較の左辺のオブジェクト。

  • right
    比較の右辺のオブジェクト。

解説

各テンプレート演算子は、!(right < left) を返します。

使用例

 

// std_tr1__regex__operator_le.cpp 
// compile with: /EHsc 
#include <regex> 
#include <iostream> 
 
typedef std::tr1::cmatch::string_type Mystr; 
int main() 
    { 
    std::tr1::regex rx("c(a*)|(b)"); 
    std::tr1::cmatch mr; 
 
    std::tr1::regex_search("xcaaay", mr, rx); 
 
    std::tr1::csub_match sub = mr[1]; 
    std::cout << "sub == " << sub << std::endl; 
    std::cout << std::endl; 
 
    std::cout << "sub <= sub == " << std::boolalpha 
        << (sub <= sub) << std::endl; 
 
    std::cout << "string(\"aab\") <= sub == " << std::boolalpha 
        << (Mystr("aab") <= sub) << std::endl; 
    std::cout << "sub <= string(\"aab\") == " << std::boolalpha 
        << (sub <= Mystr("aab")) << std::endl; 
 
    std::cout << "\"aab\" <= sub == " << std::boolalpha 
        << ("aab" <= sub) << std::endl; 
    std::cout << "sub <= \"aab\" == " << std::boolalpha 
        << (sub <= "aab") << std::endl; 
 
    std::cout << "'a' <= sub == " << std::boolalpha 
        << ('a' <= sub) << std::endl; 
    std::cout << "sub <= 'a' == " << std::boolalpha 
        << (sub <= 'a') << std::endl; 
 
    return (0); 
    } 
 
sub == aaa

sub <= sub == true
string("aab") <= sub == false
sub <= string("aab") == true
"aab" <= sub == false
sub <= "aab" == true
'a' <= sub == true
sub <= 'a' == false

必要条件

ヘッダー : <regex>

名前空間 : std::tr1

参照

参照

<regex>

operator== <regex>

operator!= <regex>

operator< <regex>

operator> <regex>

operator>= <regex>