Tiplarni dinamik tarzda


Takrorlanmaydigan (unikal) tartiblangan elementlar to‘plami


Download 1.83 Mb.
bet23/131
Sana16.06.2023
Hajmi1.83 Mb.
#1503422
1   ...   19   20   21   22   23   24   25   26   ...   131
Bog'liq
Tiplarni dinamik tarzda

Takrorlanmaydigan (unikal) tartiblangan elementlar to‘plami


. set, A = allocator> - Bu konteyner joyida qiymatlarni
o‘zgartirishga yo‘l qo‘ymaydi. - bu assosiativ konteyner bo‘lib, unikal kalitni qo‘llab quvvtlaydi (bir xil qaymatli kalitlarni qo‘llab quvvatlamaydi) va kalit yordamida tez qidirish imkonini beradi. set::iterator va set::const_iterator iteratorlar funksional ekvivalet hisoblanadi va o‘zgarganda const K& qiymat qaytaradi. Set to‘plamda qiymatni o‘zgartirish uchun avval o‘chirib tashlab so‘ng yangi qiymatni yoki o‘zgartirilgan varianti qo‘shiladi.
ning shabloni:


template ,
template class Allocator = allocator>

sinfning ochiq xususiyatlari, operatorlari va funksiyalari:

  1. Typedef operatorlari:



typedef Key key_type; typedef Key value_type;
typedef Allocator::pointer pointer; typedef Allocator::reference reference;
typedef Allocator::const_reference const_reference; typedef Compare key_compare;
typedef Compare value_compare; typedef iterator;
typedef iterator const_iterator; typedef size_type;
typedef difference_type;
typedef reverse_iterator; typedef const_reverse_iterator;






  1. set(const Compare& comp = Compare()); template
    set(InputIterator first, InputIterator last, const Compare& comp = Compare());
    set(const set& x);
    ~set();
    set& operator=(const set& x);
    void swap(set& x);
    Xotirani ajratish va bo‘shatish operatorlari (allocation/deallocation):



  1. Ruxsat berish vositalarining operatorlari (accessors):

key_compare key_comp() const; value_compare value_comp() const; iterator begin() const;
iterator end() const; reverse_iterator rbegin() const; reverse_iterator rend() const; bool empty() const;
size_type size() const; size_type max_size() const;



  1. Qo‘shish va o‘chirish operatorlari (insert/erase):



pair insert(const value_type& x); iterator insert(iterator position, const value_type& x); template
void insert(InputIterator first, InputIterator last); void erase(iterator position);
size_type erase(const key_type& x); void erase(iterator first, iterator last);






  1. iterator find(const key_type& x) const; size_type count(const key_type& x) const; iterator lower_bound(const key_type& x) const; iterator upper_bound(const key_type& x) const;
    pair equal_range(const key_type& x) const;
    To‘plam amallari (set operations):



  1. Taqqoslash operatorlari:



template bool operator==(const set& x,
const set& y);

template bool operator<(const set& x,


const set& y);



to‘plamda:



Download 1.83 Mb.

Do'stlaringiz bilan baham:
1   ...   19   20   21   22   23   24   25   26   ...   131




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling