Compartilhar via


multiset::upper_bound (STL/CLR)

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at multiset::upper_bound (STL/CLR).

Finds end of range that matches a specified key.

Syntax

iterator upper_bound(key_type key);  

Parameters

key
Key value to search for.

Remarks

The member function determines the last element X in the controlled sequence that has equivalent ordering to key. If no such element exists, or if X is the last element in the controlled sequence, it returns multiset::end (STL/CLR)(); otherwise it returns an iterator that designates the first element beyond X. You use it to locate the end of a sequence of elements currently in the controlled sequence that match a specified key.

Example

// cliext_multiset_upper_bound.cpp   
// compile with: /clr   
#include <cliext/set>   
  
typedef cliext::multiset<wchar_t> Mymultiset;   
int main()   
    {   
    Mymultiset c1;   
    c1.insert(L'a');   
    c1.insert(L'b');   
    c1.insert(L'c');   
  
// display initial contents " a b c"   
    for each (wchar_t elem in c1)   
        System::Console::Write(" {0}", elem);   
    System::Console::WriteLine();   
  
    System::Console::WriteLine("upper_bound(L'x')==end() = {0}",   
        c1.upper_bound(L'x') == c1.end());   
  
    System::Console::WriteLine("*upper_bound(L'a') = {0}",   
        *c1.upper_bound(L'a'));   
    System::Console::WriteLine("*upper_bound(L'b') = {0}",   
        *c1.upper_bound(L'b'));   
    return (0);   
    }  
  
 a b c  
upper_bound
(L'x')==end
() = True  
*upper_bound
(L'a') = b  
*upper_bound
(L'b') = c  

Requirements

Header: <cliext/set>

Namespace: cliext

See Also

multiset (STL/CLR)
multiset::count (STL/CLR)
multiset::equal_range (STL/CLR)
multiset::find (STL/CLR)
multiset::lower_bound (STL/CLR)