Partager via


map::lower_bound (STL/CLR)

Recherche le début de la plage qui correspond à une clé spécifiée.

    iterator lower_bound(key_type key);

Paramètres

  • clé
    Valeur de clé à rechercher.

Notes

La fonction membre détermine le premier élément X dans la séquence contrôlée qui a le classement équivalent à key.Si aucun élément n'existe, il retourne map::end (STL/CLR)(); sinon elle retourne un itérateur qui indique X.Vous l'utilisez pour localiser le début d'une séquence d'éléments actuellement dans la séquence contrôlée qui correspondent à une clé spécifiée.

Exemple

// cliext_map_lower_bound.cpp 
// compile with: /clr 
#include <cliext/map> 
 
typedef cliext::map<wchar_t, int> Mymap; 
int main() 
    { 
    Mymap c1; 
    c1.insert(Mymap::make_value(L'a', 1)); 
    c1.insert(Mymap::make_value(L'b', 2)); 
    c1.insert(Mymap::make_value(L'c', 3)); 
 
// display contents " [a 1] [b 2] [c 3]" 
    for each (Mymap::value_type elem in c1) 
        System::Console::Write(" [{0} {1}]", elem->first, elem->second); 
    System::Console::WriteLine(); 
 
    System::Console::WriteLine("lower_bound(L'x')==end() = {0}", 
        c1.lower_bound(L'x') == c1.end()); 
 
    Mymap::iterator it = c1.lower_bound(L'a'); 
    System::Console::WriteLine("*lower_bound(L'a') = [{0} {1}]", 
        it->first, it->second); 
    it = c1.lower_bound(L'b'); 
    System::Console::WriteLine("*lower_bound(L'b') = [{0} {1}]", 
        it->first, it->second); 
    return (0); 
    } 
 
  

Configuration requise

en-tête :<cliext/carte>

Cliext del'espace de noms :

Voir aussi

Référence

map (STL/CLR)

map::count (STL/CLR)

map::equal_range (STL/CLR)

map::find (STL/CLR)

map::upper_bound (STL/CLR)