এই টিউটোরিয়ালে, আমরা C++ STL-এ মানচিত্র equal_range বোঝার জন্য একটি প্রোগ্রাম নিয়ে আলোচনা করব।
এই ফাংশনটি ইটারেটরগুলির একটি জোড়া প্রদান করে যা ধারকটির পরিসরকে সীমাবদ্ধ করে যেখানে প্রদত্ত প্যারামিটারের সমতুল্য কী থাকে৷
উদাহরণ
#include <bits/stdc++.h>
using namespace std;
int main() {
//initializing container
map<int, int> mp;
mp.insert({ 4, 30 });
mp.insert({ 1, 40 });
mp.insert({ 6, 60 });
pair<map<int, int>::iterator,
map<int, int>::iterator>
it;
it = mp.equal_range(1);
cout << "The lower bound is " << it.first->first<< ":" << it.first->second;
cout << "\nThe upper bound is "<< it.second->first<< ":" << it.second->second;
return 0;
} আউটপুট
The lower bound is 1:40 The upper bound is 4:30৷