1+ <!doctype html>
2+ < html class ="cpprefjp " lang ="ja " itemscope ="" itemtype ="http://schema.org/WebPage ">
3+ < head >
4+
5+
6+ <!-- Google tag (gtag.js) -->
7+ < script async src ="https://www.googletagmanager.com/gtag/js?id=G-NXNBNVBTJS "> </ script >
8+ < script >
9+ window . dataLayer = window . dataLayer || [ ] ;
10+ function gtag ( ) { dataLayer . push ( arguments ) ; }
11+ gtag ( 'js' , new Date ( ) ) ;
12+
13+ gtag ( 'config' , 'G-NXNBNVBTJS' ) ;
14+ </ script >
15+
16+
17+ < meta charset ="UTF-8 ">
18+
19+ < title > flat_map::key_comp - cpprefjp C++日本語リファレンス</ title >
20+
21+ < meta name ="viewport " content ="width=device-width,initial-scale=1 ">
22+ < meta name ="keywords " content ="
23+ C++,標準ライブラリ,リファレンス,ドキュメント,STL,std,flat_map,std,flat_map,function,cpp23
24+ ">
25+ < meta name ="title " content ="flat_map::key_comp - cpprefjp C++日本語リファレンス " />
26+ < meta itemprop ="name " content ="flat_map::key_comp - cpprefjp C++日本語リファレンス " />
27+ < meta property ="og:title " content ="flat_map::key_comp - cpprefjp C++日本語リファレンス " />
28+ < meta property ="og:url " content ="https://cpprefjp.github.io/reference/flat_map/flat_map/key_comp.html " />
29+ < meta property ="og:site_name " content ="cpprefjp - C++日本語リファレンス " />
30+ < meta property ="og:type " content ="article " />
31+ < meta property ="og:description " content ="コンテナに関連づけられたキー比較用の関数オブジェクトを返す。このオブジェクトはコンテナ内の二つの要素のキー値を比較するために利用できる。 " />
32+ < meta name ="twitter:card " content ="summary " />
33+ < meta name ="twitter:title " content ="flat_map::key_comp - cpprefjp C++日本語リファレンス " />
34+ < meta name ="twitter:url " content ="https://cpprefjp.github.io/reference/flat_map/flat_map/key_comp.html " />
35+ < meta name ="twitter:description " content ="コンテナに関連づけられたキー比較用の関数オブジェクトを返す。このオブジェクトはコンテナ内の二つの要素のキー値を比較するために利用できる。 " />
36+
37+
38+ < link rel ="alternate " type ="application/atom+xml " title ="Atom " href ="https://cpprefjp.github.io/rss.xml " />
39+
40+
41+ < link rel ="apple-touch-icon " sizes ="180x180 " href ="../../../static/favicons/apple-touch-icon.png?cachebust=4d86cb7e867236a9be5b1332a0aeb5c96f257c5d ">
42+ < link rel ="icon " type ="image/png " sizes ="32x32 " href ="../../../static/favicons/favicon-32x32.png?cachebust=4d86cb7e867236a9be5b1332a0aeb5c96f257c5d ">
43+ < link rel ="icon " type ="image/png " sizes ="16x16 " href ="../../../static/favicons/favicon-16x16.png?cachebust=4d86cb7e867236a9be5b1332a0aeb5c96f257c5d ">
44+ < link rel ="manifest " href ="../../../manifest.json?cachebust=4d86cb7e867236a9be5b1332a0aeb5c96f257c5d ">
45+ < meta name ="theme-color " content ="#f5f8fc ">
46+
47+ < link rel ="stylesheet " href ="../../../static/pygments/default.css?cachebust=4d86cb7e867236a9be5b1332a0aeb5c96f257c5d ">
48+ <!-- <link rel="stylesheet" href="../../../static/css/root.css"> -->
49+
50+
51+
52+
53+
54+ < link href ="../../../static/kunai/css/kunai-stage-0.css?cachebust=4d86cb7e867236a9be5b1332a0aeb5c96f257c5d " rel ="stylesheet ">
55+ < link href ="../../../static/kunai/css/kunai-stage-1.css?cachebust=4d86cb7e867236a9be5b1332a0aeb5c96f257c5d " rel ="stylesheet ">
56+ < link href ="../../../static/kunai/css/kunai-stage-2.css?cachebust=4d86cb7e867236a9be5b1332a0aeb5c96f257c5d " rel ="stylesheet ">
57+ < link href ="../../../static/kunai/css/kunai-stage-3.css?cachebust=4d86cb7e867236a9be5b1332a0aeb5c96f257c5d " rel ="stylesheet ">
58+
59+ < script type ="text/javascript " src ="../../../static/kunai/js/kunai-vendor.js?cachebust=4d86cb7e867236a9be5b1332a0aeb5c96f257c5d "> </ script >
60+ < script type ="text/javascript " src ="../../../static/kunai/js/kunai.js?cachebust=4d86cb7e867236a9be5b1332a0aeb5c96f257c5d "> </ script >
61+
62+ < script type ="text/javascript ">
63+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
64+ var kn = new Kunai ;
65+ kn . cpprefjp ( ) ;
66+ } ) ;
67+ </ script >
68+
69+ </ head >
70+ < body >
71+ < header data-kunai-mdinfo ="{"meta": {"header": ["flat_map"], "namespace": ["std"], "class": ["flat_map"], "id-type": ["function"], "cpp": ["cpp23"]}, "sources": [{"id": "e104560e572f39011d6590968dc6ab6953aa9321", "source": "#include <flat_map>\n#include <iostream>\n\nint main()\n{\n std::flat_map<int, char> m;\n std::flat_map<int, char>::key_compare comp = m.key_comp();\n\n std::cout << comp(1, 2) << std::endl;\n std::cout << comp(3, 2) << std::endl;\n}\n"}], "page_id": ["reference", "flat_map", "flat_map", "key_comp"]} ">
72+ < nav class ="navbar navbar-default " role ="navigation ">
73+ < div class ="container-fluid ">
74+ < div class ="navbar-header ">
75+ < button type ="button " class ="navbar-toggle collapsed " data-toggle ="collapse " data-target ="#navbar-collapse ">
76+ < span class ="sr-only "> Toggle navigation</ span >
77+ < span class ="icon-bar "> </ span >
78+ < span class ="icon-bar "> </ span >
79+ < span class ="icon-bar "> </ span >
80+ </ button >
81+ < a class ="navbar-brand " href ="../../../index.html ">
82+ < div class ="title-wrapper clearfix ">
83+ < div class ="title "> cpprefjp - C++日本語リファレンス</ div >
84+ </ div >
85+ </ a >
86+ </ div >
87+
88+ < div class ="collapse navbar-collapse " id ="navbar-collapse ">
89+ < ul class ="nav navbar-nav navbar-right ">
90+ < li >
91+ < div class ="google-search ">
92+
93+
94+ < script >
95+ ( function ( ) {
96+ var cx = '013316413321391058734:ji_u66hl7hq' ;
97+ var gcse = document . createElement ( 'script' ) ;
98+ gcse . type = 'text/javascript' ;
99+ gcse . async = true ;
100+ gcse . src = ( document . location . protocol == 'https:' ? 'https:' : 'http:' ) +
101+ '//www.google.com/cse/cse.js?cx=' + cx ;
102+ var s = document . getElementsByTagName ( 'script' ) [ 0 ] ;
103+ s . parentNode . insertBefore ( gcse , s ) ;
104+ } ) ( ) ;
105+ </ script >
106+ < div class ="gcse-search "> </ div >
107+
108+
109+ </ div >
110+ </ li >
111+ < li >
112+ < a href ="https://github.com/cpprefjp/site "> GitHub Project</ a >
113+ </ li >
114+ </ ul >
115+ </ div >
116+ </ div >
117+ </ nav >
118+ </ header >
119+
120+ < main id ="main " role ="main ">
121+ < div class ="container-fluid ">
122+ < div class ="row ">
123+ < div class ="col-sm-9 col-sm-push-3 " itemscope itemtype ="http://schema.org/Article ">
124+ < div class ="row ">
125+ < div class ="col-sm-12 google-search-result ">
126+ < gcse:searchresults > </ gcse:searchresults >
127+ </ div >
128+ </ div >
129+ < div class ="row ">
130+ < div class ="col-sm-12 content-header ">
131+
132+ < ol class ="breadcrumb ">
133+
134+ < li itemscope itemtype ="http://www.schema.org/SiteNavigationElement ">
135+ < span >
136+
137+ < a href ="../../../index.html " itemprop ="url ">
138+
139+ < i class ="fa fa-fw fa-home "> </ i >
140+
141+ </ a >
142+
143+ </ span >
144+ </ li >
145+
146+ < li itemscope itemtype ="http://www.schema.org/SiteNavigationElement ">
147+ < span >
148+
149+ < a href ="../../../reference.html " itemprop ="url ">
150+
151+ < span itemprop ="name "> リファレンス</ span >
152+
153+ </ a >
154+
155+ </ span >
156+ </ li >
157+
158+ < li itemscope itemtype ="http://www.schema.org/SiteNavigationElement ">
159+ < span >
160+
161+ < a href ="../../../reference/flat_map.html " itemprop ="url ">
162+
163+ < span itemprop ="name "> flat_map</ span >
164+
165+ </ a >
166+
167+ </ span >
168+ </ li >
169+
170+ < li itemscope itemtype ="http://www.schema.org/SiteNavigationElement ">
171+ < span >
172+
173+ < a href ="../../../reference/flat_map/flat_map.html " itemprop ="url ">
174+
175+ < span itemprop ="name "> flat_map</ span >
176+
177+ </ a >
178+
179+ </ span >
180+ </ li >
181+
182+ < li class ="active " itemscope itemtype ="http://www.schema.org/SiteNavigationElement ">
183+ < span >
184+
185+
186+ < span itemprop ="name "> key_comp</ span >
187+
188+
189+ </ span >
190+ </ li >
191+
192+ </ ol >
193+ < div class ="crsearch "> </ div >
194+
195+ </ div >
196+ </ div >
197+ < div class ="row ">
198+ < div class ="col-sm-12 edit-button ">
199+
200+
201+ < p class ="text-right "> < small >
202+ 最終更新日時(UTC):
203+ < span itemprop ="datePublished " content ="2025-01-26T08:31:30 ">
204+ 2025年01月26日 08時31分30秒
205+ </ span >
206+ < br />
207+ < span itemprop ="author " itemscope itemtype ="http://schema.org/Person ">
208+ < span itemprop ="name "> suomesta</ span >
209+ </ span >
210+ が更新
211+ </ small > </ p >
212+
213+
214+ < p class ="text-right ">
215+ < a class ="history " target ="_blank " href ="https://github.com/cpprefjp/site/commits/master/reference/flat_map/flat_map/key_comp.md ">
216+ < span class ="fa fa-fw fa-clock-o fa-flip-horizontal "> </ span > 履歴
217+ </ a >
218+ < a class ="edit " target ="_blank " href ="https://github.com/cpprefjp/site/edit/master/reference/flat_map/flat_map/key_comp.md ">
219+ < span class ="fa fa-fw fa-pencil "> </ span > 編集
220+ </ a >
221+ </ p >
222+ </ div >
223+ </ div >
224+ < div class ="row ">
225+ < div class ="col-sm-12 content-body ">
226+
227+ < div class ="identifier-type "> function</ div > < div class ="header "> <flat_map></ div > < h1 itemprop ="name "> < span class ="namespace " title ="namespace std "> std::</ span > < span class ="class " title ="class flat_map "> flat_map::</ span > < span class ="token "> key_comp</ span > < span class ="cpp cpp23 " title ="C++23で追加 "> (C++23)</ span > </ h1 >
228+ < div itemprop ="articleBody "> < p > < div class ="codehilite "> < pre > < span > </ span > < code > < span class ="n "> key_compare</ span > < span class ="nf "> key_comp</ span > < span class ="p "> ()</ span > < span class ="k "> const</ span > < span class ="p "> ;</ span > < span class ="c1 "> // C++23</ span >
229+ </ code > </ pre > </ div >
230+ </ p >
231+ < h2 > 概要</ h2 >
232+ < p > コンテナに関連づけられたキー比較用の関数オブジェクトを返す。このオブジェクトはコンテナ内の二つの要素のキー値を比較するために利用できる。
233+ この比較オブジェクトはオブジェクトの構築時に与えられ、関数へのポインタでも関数オブジェクトでも良い。いずれの場合でも、これは同じ型の 2 つの引数をとり、< a href ="../../algorithm.html#strict-weak-ordering "> 狭義の弱順序</ a > に従って一つ目の引数が二つ目の引数より前のときに < code > true</ code > を返し、そうでないときに < code > false</ code > を返す。</ p >
234+ < h2 > < a class ="cpprefjp-defined-word " data-desc ="関数呼び出し式の評価結果となるオブジェクト・値 "> 戻り値</ a > </ h2 >
235+ < p > 比較オブジェクト。< code > key_compare</ code > はメンバ型であり、テンプレートパラメータ < code > Compare</ code > の別名として定義される。</ p >
236+ < h2 > < a class ="cpprefjp-defined-word " data-desc ="関数等の意味論を構成する要素の1つ。Complexity。関数が使うアルゴリズムの空間計算量・時間計算量 "> 計算量</ a > </ h2 >
237+ < p > 定数時間。</ p >
238+ < h2 > 例</ h2 >
239+ < p > < div class ="yata " id ="e104560e572f39011d6590968dc6ab6953aa9321 "> < div class ="codehilite "> < pre > < span > </ span > < code > < span class ="cp "> #include</ span > < span class ="cpf "> < a href ="../../flat_map.html "> <flat_map></ a > </ span > < span class ="cp "> </ span >
240+ < span class ="cp "> #include</ span > < span class ="cpf "> < a href ="../../iostream.html "> <iostream></ a > </ span > < span class ="cp "> </ span >
241+
242+ < span class ="kt "> int</ span > < span class ="nf "> main</ span > < span class ="p "> ()</ span >
243+ < span class ="p "> {</ span >
244+ < span class ="n "> std</ span > < span class ="o "> ::</ span > < span class ="n "> flat_map</ span > < span class ="o "> <</ span > < span class ="kt "> int</ span > < span class ="p "> ,</ span > < span class ="kt "> char</ span > < span class ="o "> ></ span > < span class ="n "> m</ span > < span class ="p "> ;</ span >
245+ < span class ="n "> std</ span > < span class ="o "> ::</ span > < span class ="n "> flat_map</ span > < span class ="o "> <</ span > < span class ="kt "> int</ span > < span class ="p "> ,</ span > < span class ="kt "> char</ span > < span class ="o "> >::</ span > < span class ="n "> key_compare</ span > < span class ="n "> comp</ span > < span class ="o "> =</ span > < span class ="n "> m</ span > < span class ="p "> .</ span > < span class ="n "> < span style ="color:#ff0000 "> key_comp()</ span > </ span > < span class ="p "> ;</ span >
246+
247+ < span class ="n "> < a href ="../../iostream/cout.html "> std::cout</ a > </ span > < span class ="o "> <<</ span > < span class ="n "> comp</ span > < span class ="p "> (</ span > < span class ="mi "> 1</ span > < span class ="p "> ,</ span > < span class ="mi "> 2</ span > < span class ="p "> )</ span > < span class ="o "> <<</ span > < span class ="n "> < a href ="../../ostream/endl.html "> std::endl</ a > </ span > < span class ="p "> ;</ span >
248+ < span class ="n "> < a href ="../../iostream/cout.html "> std::cout</ a > </ span > < span class ="o "> <<</ span > < span class ="n "> comp</ span > < span class ="p "> (</ span > < span class ="mi "> 3</ span > < span class ="p "> ,</ span > < span class ="mi "> 2</ span > < span class ="p "> )</ span > < span class ="o "> <<</ span > < span class ="n "> < a href ="../../ostream/endl.html "> std::endl</ a > </ span > < span class ="p "> ;</ span >
249+ < span class ="p "> }</ span >
250+ </ code > </ pre > </ div >
251+ </ div > </ p >
252+ < h3 > 出力</ h3 >
253+ < p > < pre > < code > 1
254+ 0
255+ </ code > </ pre > </ p >
256+ < h2 > バージョン</ h2 >
257+ < h3 > 言語</ h3 >
258+ < ul >
259+ < li > C++23</ li >
260+ </ ul >
261+ < h3 > 処理系</ h3 >
262+ < ul >
263+ < li > < a href ="../../../implementation.html#clang "> Clang</ a > : ??</ li >
264+ < li > < a href ="../../../implementation.html#gcc "> GCC</ a > : ??</ li >
265+ < li > < a href ="../../../implementation.html#icc "> ICC</ a > : ??</ li >
266+ < li > < a href ="../../../implementation.html#visual_cpp "> Visual C++</ a > : ??</ li >
267+ </ ul >
268+ < h2 > 関連項目</ h2 >
269+ < table border ="1 " bordercolor ="#888 " style ="border-collapse:collapse ">
270+ < thead >
271+ < tr >
272+ < th > 名前</ th >
273+ < th > 説明</ th >
274+ </ tr >
275+ </ thead >
276+ < tbody >
277+ < tr >
278+ < td > < code > < a href ="value_comp.html "> value_comp</ a > </ code > </ td >
279+ < td > 要素比較用の関数オブジェクトを返す</ td >
280+ </ tr >
281+ < tr >
282+ < td > < code > < a href ="value_compare.html "> value_compare</ a > </ code > </ td >
283+ < td > 要素値のキー部分で大小関係を判定する二項< a class ="cpprefjp-defined-word " data-desc ="boolを返す関数・関数オブジェクト。predicate "> 述語</ a > の型</ td >
284+ </ tr >
285+ </ tbody >
286+ </ table > </ div >
287+
288+ </ div >
289+ </ div >
290+ </ div >
291+
292+
293+ < div id ="sidebar " class ="col-sm-3 col-sm-pull-9 ">
294+ </ div >
295+
296+
297+ </ div >
298+ </ div >
299+ </ main >
300+ < footer class ="footer navbar navbar-default ">
301+ < div class ="container-fluid ">
302+ < p > < small >
303+ 本サイトの情報は、
304+ < a href ="https://creativecommons.org/licenses/by/3.0/deed.ja " rel ="nofollow "> クリエイティブ・コモンズ 表示 3.0 非移植 ライセンス(CC BY)</ a >
305+ の下に提供されています。
306+ </ small > </ p >
307+ </ div >
308+ </ footer >
309+ </ body >
310+ </ html >
0 commit comments