set::count
来源:互联网 发布:centos l2tp 编辑:程序博客网 时间:2024/05/20 21:44
set::count
Visual Studio .NET 2003
其他版本
Returns the number of elements in a set whose key matches a parameter-specified key.
size_type count( const Key& _Key) const;
Parameter
- _Key
- The key of the elements to be matched from the set.
Return Value
1 if the set contains an element whose sort key matches the parameter key. 0 if the set does not contain an element with a matching key.
Remarks
The member function returns the number of elements in the following range:
[lower_bound (_Key ), upper_bound (_Key ) ).
Example
// set_count.cpp// compile with: /EHsc#include <set>#include <iostream>int main( ){ using namespace std; set <int> s1; int i; s1.insert( 1 ); s1.insert( 1 ); // Keys must be unique in set, so duplicates are ignored i = s1.count( 1 ); cout << "The number of elements in s1 with a sort key of 1 is: " << i << "." << endl; i = s1.count( 2 ); cout << "The number of elements in s1 with a sort key of 2 is: " << i << "." << endl;}
Output
The number of elements in s1 with a sort key of 1 is: 1.The number of elements in s1 with a sort key of 2 is: 0.
0 0
- set::count
- STL_set——set::count
- set:: begin ,clear, count, empty, end, equal_range
- Count set bits in an integer
- Count the Number(set 金马五校赛-东华大学)
- CCSet(内部std::set实现 成员std::set<CCObject *> *m_pSet count addObject containsObject begin anyObject)
- Count
- COUNT
- count
- Count
- count
- count
- count
- count
- Count
- count
- Count
- Count total set bits in all numbers from 1 to n
- LeetCode OJ Word Ladder II
- php 面试题收集
- android获取多媒体库的视频、音频、图片
- CCTV10专题《重访---黑客江湖》
- Subsets
- set::count
- Servlet 3.0 新特性详解(三)注解支持
- 分析.lds文件格式
- Win7+OpenCV2.4.10+VS2010安装教程
- 社説 20150328 大塚家具内紛 勝者なき不毛な親子げんか
- 学习笔记(2):Qt状态机初识
- 蓝桥杯.取字符(去掉重复的使用set list实现)
- const常量与define 的区别
- 社説 20150328 御嶽山噴火半年 惨事を繰り返さぬ体制整備を