Files
ortools-clone/docs/cpp/vector__map_8h_source.html
Mizux Seiha d1b6751cad Update doc
2020-11-18 14:53:53 +01:00

256 lines
41 KiB
HTML

<!-- HTML header for doxygen 1.8.18-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>OR-Tools: vector_map.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="styleSheet.tmp.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="orLogo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">OR-Tools
&#160;<span id="projectnumber">8.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('vector__map_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">vector_map.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="vector__map_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">// Copyright 2010-2018 Google LLC</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment">// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment">// you may not use this file except in compliance with the License.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment">// You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment">// Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment">// distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment">// See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment">// limitations under the License.</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160; </div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment">// Vector with map from element to index in the vector.</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160; </div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="preprocessor">#ifndef OR_TOOLS_UTIL_VECTOR_MAP_H_</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="preprocessor">#define OR_TOOLS_UTIL_VECTOR_MAP_H_</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160; </div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160; </div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#include &quot;absl/container/flat_hash_map.h&quot;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="map__util_8h.html">ortools/base/map_util.h</a>&quot;</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; </div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceoperations__research.html">operations_research</a> {</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; </div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="comment">// This class stores a vector of distinct elements, as well as a map</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="comment">// from elements to index to find the index in the vector.</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="comment">// This is useful to store mapping between objects and indices.</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;</div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html"> 30</a></span>&#160;<span class="keyword">class </span><a class="code" href="classoperations__research_1_1_vector_map.html">VectorMap</a> {</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; <span class="comment">// Adds an element if not already present, and returns its index in</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; <span class="comment">// the vector-map.</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a1f665a2e76399cbf821a5ef03eb5d400"> 34</a></span>&#160; <span class="keywordtype">int</span> <a class="code" href="classoperations__research_1_1_vector_map.html#a1f665a2e76399cbf821a5ef03eb5d400">Add</a>(<span class="keyword">const</span> T&amp; element) {</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; <span class="keywordtype">int</span> current_index = <a class="code" href="classoperations__research_1_1_vector_map.html#af31997ebd277a4c0d81b30f7b793d65d">Index</a>(element);</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; <span class="keywordflow">if</span> (current_index != -1) {</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; <span class="keywordflow">return</span> current_index;</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; }</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="pack_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a> = list_.size();</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; <a class="code" href="base_2logging_8h.html#a7c0ce053b28d53aa4eaf3eb7fb71663b">CHECK_EQ</a>(<a class="code" href="pack_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>, map_.size());</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; list_.push_back(element);</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; map_[element] = <a class="code" href="pack_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>;</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; <span class="keywordflow">return</span> <a class="code" href="pack_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>;</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; }</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="comment">// TODO(user): Use ArraySlice.</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; </div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <span class="comment">// Adds all elements of the vector.</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a9f752d420efd9bd451bed6759248617c"> 48</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="classoperations__research_1_1_vector_map.html#a9f752d420efd9bd451bed6759248617c">Add</a>(<span class="keyword">const</span> std::vector&lt;T&gt;&amp; elements) {</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; elements.size(); ++i) {</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <a class="code" href="classoperations__research_1_1_vector_map.html#a1f665a2e76399cbf821a5ef03eb5d400">Add</a>(elements[i]);</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; }</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; }</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; </div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; <span class="comment">// Will return the index of the element if present, or die otherwise.</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a907b6c90ba3b3598d306f5b7c30b5023"> 55</a></span>&#160; <span class="keywordtype">int</span> <a class="code" href="classoperations__research_1_1_vector_map.html#a907b6c90ba3b3598d306f5b7c30b5023">IndexOrDie</a>(<span class="keyword">const</span> T&amp; element)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; <span class="keywordflow">return</span> <a class="code" href="namespacegtl.html#abce27d097bc5680207b294bdad75f59f">gtl::FindOrDie</a>(map_, element);</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; }</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; </div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; <span class="comment">// Returns -1 if the element is not in the vector, or its unique</span></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; <span class="comment">// index if it is.</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#af31997ebd277a4c0d81b30f7b793d65d"> 61</a></span>&#160; <span class="keywordtype">int</span> <a class="code" href="classoperations__research_1_1_vector_map.html#af31997ebd277a4c0d81b30f7b793d65d">Index</a>(<span class="keyword">const</span> T&amp; element)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; <span class="keywordflow">return</span> <a class="code" href="namespacegtl.html#abc18f60961e36340e64e428827c0e38e">gtl::FindWithDefault</a>(map_, element, -1);</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; }</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; <span class="comment">// TODO(user): explore a int-type version.</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; </div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <span class="comment">// Returns whether the element has already been added to the vector-map.</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a4b9946b6fc9ff762ac72124ae91777bc"> 67</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="classoperations__research_1_1_vector_map.html#a4b9946b6fc9ff762ac72124ae91777bc">Contains</a>(<span class="keyword">const</span> T&amp; element)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; <span class="keywordflow">return</span> <a class="code" href="namespacegtl.html#aae28e97bd1fa93cb0032642550da7455">gtl::ContainsKey</a>(map_, element);</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; }</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; </div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; <span class="comment">// Returns the element at position index.</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a808e9e47c129687f33ad46a00c642cd4"> 72</a></span>&#160; <span class="keyword">const</span> T&amp; <a class="code" href="classoperations__research_1_1_vector_map.html#a808e9e47c129687f33ad46a00c642cd4">Element</a>(<span class="keywordtype">int</span> <a class="code" href="pack_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; <a class="code" href="base_2logging_8h.html#a7cc25402ecd7591b4c39934dd656b1f9">CHECK_GE</a>(<a class="code" href="pack_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>, 0);</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; <a class="code" href="base_2logging_8h.html#a4bd2e815ca2f702a4b6aa744b1ff3b82">CHECK_LT</a>(<a class="code" href="pack_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>, list_.size());</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="keywordflow">return</span> list_[<a class="code" href="pack_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>];</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; }</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; </div>
<div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#ab3f0073680dabba9d2778d9a6f35aed7"> 78</a></span>&#160; <span class="keyword">const</span> T&amp; <a class="code" href="classoperations__research_1_1_vector_map.html#ab3f0073680dabba9d2778d9a6f35aed7">operator[]</a>(<span class="keywordtype">int</span> <a class="code" href="pack_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classoperations__research_1_1_vector_map.html#a808e9e47c129687f33ad46a00c642cd4">Element</a>(<a class="code" href="pack_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>); }</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; </div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; <span class="comment">// Returns the number of distinct elements added to the vector-map.</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#af9593d4a5ff4274efaf429cb4f9e57cc"> 81</a></span>&#160; <span class="keywordtype">int</span> <a class="code" href="classoperations__research_1_1_vector_map.html#af9593d4a5ff4274efaf429cb4f9e57cc">size</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> list_.size(); }</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; </div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; <span class="comment">// Clears all the elements added to the vector-map.</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#ac8bb3912a3ce86b15842e79d0b421204"> 84</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="classoperations__research_1_1_vector_map.html#ac8bb3912a3ce86b15842e79d0b421204">clear</a>() {</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; list_.clear();</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; map_.clear();</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; }</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; </div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; <span class="comment">// Returns a read-only access to the vector of elements.</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a67d87f2c597ff45b845251af7ed97a92"> 90</a></span>&#160; <span class="keyword">const</span> std::vector&lt;T&gt;&amp; <a class="code" href="classoperations__research_1_1_vector_map.html#a67d87f2c597ff45b845251af7ed97a92">list</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> list_; }</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; </div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; <span class="comment">// Standard STL container boilerplate.</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a265a253612b46abed17c61b0a5e5ce30"> 93</a></span>&#160; <span class="keyword">typedef</span> T <a class="code" href="classoperations__research_1_1_vector_map.html#a265a253612b46abed17c61b0a5e5ce30">value_type</a>;</div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a2950e0a6095bb531a38185d9cb47f7e6"> 94</a></span>&#160; <span class="keyword">typedef</span> <span class="keyword">const</span> T* <a class="code" href="classoperations__research_1_1_vector_map.html#a2950e0a6095bb531a38185d9cb47f7e6">pointer</a>;</div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a4fef7a13b0a31eb10c0ae4c731a0e2d3"> 95</a></span>&#160; <span class="keyword">typedef</span> <span class="keyword">const</span> T&amp; <a class="code" href="classoperations__research_1_1_vector_map.html#a4fef7a13b0a31eb10c0ae4c731a0e2d3">reference</a>;</div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#af9ba3e25df088c62f7d535b91672cda9"> 96</a></span>&#160; <span class="keyword">typedef</span> <span class="keyword">const</span> T&amp; <a class="code" href="classoperations__research_1_1_vector_map.html#af9ba3e25df088c62f7d535b91672cda9">const_reference</a>;</div>
<div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a49b489a408a211a90e766329c0732d7b"> 97</a></span>&#160; <span class="keyword">typedef</span> <span class="keywordtype">size_t</span> <a class="code" href="classoperations__research_1_1_vector_map.html#a49b489a408a211a90e766329c0732d7b">size_type</a>;</div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#acf947bbb9e09f863cc3572ff8550b183"> 98</a></span>&#160; <span class="keyword">typedef</span> ptrdiff_t <a class="code" href="classoperations__research_1_1_vector_map.html#acf947bbb9e09f863cc3572ff8550b183">difference_type</a>;</div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#ab87de14283f53f998f4113b7d96f33b1"> 99</a></span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classoperations__research_1_1_vector_map.html#a49b489a408a211a90e766329c0732d7b">size_type</a> <a class="code" href="classoperations__research_1_1_vector_map.html#ab87de14283f53f998f4113b7d96f33b1">npos</a>;</div>
<div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a2fc97dce62b7053449cc868607540dba"> 100</a></span>&#160; <span class="keyword">typedef</span> <span class="keyword">const</span> T* <a class="code" href="classoperations__research_1_1_vector_map.html#a2fc97dce62b7053449cc868607540dba">const_iterator</a>;</div>
<div class="line"><a name="l00101"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a421ef78ccdc84f0f6b2b14e2732527ba"> 101</a></span>&#160; <span class="keyword">typedef</span> std::reverse_iterator&lt;const_iterator&gt; <a class="code" href="classoperations__research_1_1_vector_map.html#a421ef78ccdc84f0f6b2b14e2732527ba">const_reverse_iterator</a>;</div>
<div class="line"><a name="l00102"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a29305669b60ca1680752e2fc3592ba99"> 102</a></span>&#160; <a class="code" href="classoperations__research_1_1_vector_map.html#a2fc97dce62b7053449cc868607540dba">const_iterator</a> <a class="code" href="classoperations__research_1_1_vector_map.html#a29305669b60ca1680752e2fc3592ba99">begin</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> list_.data(); }</div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#accf9a4bd0c34d4a5f6a7dab66ea10cdc"> 103</a></span>&#160; <a class="code" href="classoperations__research_1_1_vector_map.html#a2fc97dce62b7053449cc868607540dba">const_iterator</a> <a class="code" href="classoperations__research_1_1_vector_map.html#accf9a4bd0c34d4a5f6a7dab66ea10cdc">end</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> list_.data() + list_.size(); }</div>
<div class="line"><a name="l00104"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#af086cceac199bd735c7a97c2a8d7ed21"> 104</a></span>&#160; <a class="code" href="classoperations__research_1_1_vector_map.html#a421ef78ccdc84f0f6b2b14e2732527ba">const_reverse_iterator</a> <a class="code" href="classoperations__research_1_1_vector_map.html#af086cceac199bd735c7a97c2a8d7ed21">rbegin</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; <span class="keywordflow">return</span> <a class="code" href="classoperations__research_1_1_vector_map.html#a421ef78ccdc84f0f6b2b14e2732527ba">const_reverse_iterator</a>(list_.data() + list_.size());</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; }</div>
<div class="line"><a name="l00107"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a07da1fdc890b6949f1a20a1961c6fc44"> 107</a></span>&#160; <a class="code" href="classoperations__research_1_1_vector_map.html#a421ef78ccdc84f0f6b2b14e2732527ba">const_reverse_iterator</a> <a class="code" href="classoperations__research_1_1_vector_map.html#a07da1fdc890b6949f1a20a1961c6fc44">rend</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; <span class="keywordflow">return</span> <a class="code" href="classoperations__research_1_1_vector_map.html#a421ef78ccdc84f0f6b2b14e2732527ba">const_reverse_iterator</a>(list_.data());</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; }</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; </div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; std::vector&lt;T&gt; list_;</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; absl::flat_hash_map&lt;T, int&gt; map_;</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160;};</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; </div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;} <span class="comment">// namespace operations_research</span></div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160;<span class="preprocessor">#endif // OR_TOOLS_UTIL_VECTOR_MAP_H_</span></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_af9ba3e25df088c62f7d535b91672cda9"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#af9ba3e25df088c62f7d535b91672cda9">operations_research::VectorMap::const_reference</a></div><div class="ttdeci">const T &amp; const_reference</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00096">vector_map.h:96</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a9f752d420efd9bd451bed6759248617c"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a9f752d420efd9bd451bed6759248617c">operations_research::VectorMap::Add</a></div><div class="ttdeci">void Add(const std::vector&lt; T &gt; &amp;elements)</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00048">vector_map.h:48</a></div></div>
<div class="ttc" id="amap__util_8h_html"><div class="ttname"><a href="map__util_8h.html">map_util.h</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a2950e0a6095bb531a38185d9cb47f7e6"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a2950e0a6095bb531a38185d9cb47f7e6">operations_research::VectorMap::pointer</a></div><div class="ttdeci">const T * pointer</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00094">vector_map.h:94</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a29305669b60ca1680752e2fc3592ba99"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a29305669b60ca1680752e2fc3592ba99">operations_research::VectorMap::begin</a></div><div class="ttdeci">const_iterator begin() const</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00102">vector_map.h:102</a></div></div>
<div class="ttc" id="abase_2logging_8h_html_a7cc25402ecd7591b4c39934dd656b1f9"><div class="ttname"><a href="base_2logging_8h.html#a7cc25402ecd7591b4c39934dd656b1f9">CHECK_GE</a></div><div class="ttdeci">#define CHECK_GE(val1, val2)</div><div class="ttdef"><b>Definition:</b> <a href="base_2logging_8h_source.html#l00701">base/logging.h:701</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html">operations_research::VectorMap</a></div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00030">vector_map.h:30</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_ac8bb3912a3ce86b15842e79d0b421204"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#ac8bb3912a3ce86b15842e79d0b421204">operations_research::VectorMap::clear</a></div><div class="ttdeci">void clear()</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00084">vector_map.h:84</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_ab3f0073680dabba9d2778d9a6f35aed7"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#ab3f0073680dabba9d2778d9a6f35aed7">operations_research::VectorMap::operator[]</a></div><div class="ttdeci">const T &amp; operator[](int index) const</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00078">vector_map.h:78</a></div></div>
<div class="ttc" id="abase_2logging_8h_html_a4bd2e815ca2f702a4b6aa744b1ff3b82"><div class="ttname"><a href="base_2logging_8h.html#a4bd2e815ca2f702a4b6aa744b1ff3b82">CHECK_LT</a></div><div class="ttdeci">#define CHECK_LT(val1, val2)</div><div class="ttdef"><b>Definition:</b> <a href="base_2logging_8h_source.html#l00700">base/logging.h:700</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_ab87de14283f53f998f4113b7d96f33b1"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#ab87de14283f53f998f4113b7d96f33b1">operations_research::VectorMap::npos</a></div><div class="ttdeci">static const size_type npos</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00099">vector_map.h:99</a></div></div>
<div class="ttc" id="anamespacegtl_html_abc18f60961e36340e64e428827c0e38e"><div class="ttname"><a href="namespacegtl.html#abc18f60961e36340e64e428827c0e38e">gtl::FindWithDefault</a></div><div class="ttdeci">const Collection::value_type::second_type &amp; FindWithDefault(const Collection &amp;collection, const typename Collection::value_type::first_type &amp;key, const typename Collection::value_type::second_type &amp;value)</div><div class="ttdef"><b>Definition:</b> <a href="map__util_8h_source.html#l00026">map_util.h:26</a></div></div>
<div class="ttc" id="anamespaceoperations__research_html"><div class="ttname"><a href="namespaceoperations__research.html">operations_research</a></div><div class="ttdoc">The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...</div><div class="ttdef"><b>Definition:</b> <a href="dense__doubly__linked__list_8h_source.html#l00021">dense_doubly_linked_list.h:21</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a67d87f2c597ff45b845251af7ed97a92"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a67d87f2c597ff45b845251af7ed97a92">operations_research::VectorMap::list</a></div><div class="ttdeci">const std::vector&lt; T &gt; &amp; list() const</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00090">vector_map.h:90</a></div></div>
<div class="ttc" id="apack_8cc_html_a750b5d744c39a06bfb13e6eb010e35d0"><div class="ttname"><a href="pack_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a></div><div class="ttdeci">int index</div><div class="ttdef"><b>Definition:</b> <a href="pack_8cc_source.html#l00508">pack.cc:508</a></div></div>
<div class="ttc" id="anamespacegtl_html_abce27d097bc5680207b294bdad75f59f"><div class="ttname"><a href="namespacegtl.html#abce27d097bc5680207b294bdad75f59f">gtl::FindOrDie</a></div><div class="ttdeci">const Collection::value_type::second_type &amp; FindOrDie(const Collection &amp;collection, const typename Collection::value_type::first_type &amp;key)</div><div class="ttdef"><b>Definition:</b> <a href="map__util_8h_source.html#l00176">map_util.h:176</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a4b9946b6fc9ff762ac72124ae91777bc"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a4b9946b6fc9ff762ac72124ae91777bc">operations_research::VectorMap::Contains</a></div><div class="ttdeci">bool Contains(const T &amp;element) const</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00067">vector_map.h:67</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_acf947bbb9e09f863cc3572ff8550b183"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#acf947bbb9e09f863cc3572ff8550b183">operations_research::VectorMap::difference_type</a></div><div class="ttdeci">ptrdiff_t difference_type</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00098">vector_map.h:98</a></div></div>
<div class="ttc" id="abase_2logging_8h_html_a7c0ce053b28d53aa4eaf3eb7fb71663b"><div class="ttname"><a href="base_2logging_8h.html#a7c0ce053b28d53aa4eaf3eb7fb71663b">CHECK_EQ</a></div><div class="ttdeci">#define CHECK_EQ(val1, val2)</div><div class="ttdef"><b>Definition:</b> <a href="base_2logging_8h_source.html#l00697">base/logging.h:697</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a265a253612b46abed17c61b0a5e5ce30"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a265a253612b46abed17c61b0a5e5ce30">operations_research::VectorMap::value_type</a></div><div class="ttdeci">T value_type</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00093">vector_map.h:93</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a1f665a2e76399cbf821a5ef03eb5d400"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a1f665a2e76399cbf821a5ef03eb5d400">operations_research::VectorMap::Add</a></div><div class="ttdeci">int Add(const T &amp;element)</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00034">vector_map.h:34</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_af31997ebd277a4c0d81b30f7b793d65d"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#af31997ebd277a4c0d81b30f7b793d65d">operations_research::VectorMap::Index</a></div><div class="ttdeci">int Index(const T &amp;element) const</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00061">vector_map.h:61</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a808e9e47c129687f33ad46a00c642cd4"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a808e9e47c129687f33ad46a00c642cd4">operations_research::VectorMap::Element</a></div><div class="ttdeci">const T &amp; Element(int index) const</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00072">vector_map.h:72</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_af9593d4a5ff4274efaf429cb4f9e57cc"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#af9593d4a5ff4274efaf429cb4f9e57cc">operations_research::VectorMap::size</a></div><div class="ttdeci">int size() const</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00081">vector_map.h:81</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a2fc97dce62b7053449cc868607540dba"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a2fc97dce62b7053449cc868607540dba">operations_research::VectorMap::const_iterator</a></div><div class="ttdeci">const T * const_iterator</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00100">vector_map.h:100</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_accf9a4bd0c34d4a5f6a7dab66ea10cdc"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#accf9a4bd0c34d4a5f6a7dab66ea10cdc">operations_research::VectorMap::end</a></div><div class="ttdeci">const_iterator end() const</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00103">vector_map.h:103</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a907b6c90ba3b3598d306f5b7c30b5023"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a907b6c90ba3b3598d306f5b7c30b5023">operations_research::VectorMap::IndexOrDie</a></div><div class="ttdeci">int IndexOrDie(const T &amp;element) const</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00055">vector_map.h:55</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a421ef78ccdc84f0f6b2b14e2732527ba"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a421ef78ccdc84f0f6b2b14e2732527ba">operations_research::VectorMap::const_reverse_iterator</a></div><div class="ttdeci">std::reverse_iterator&lt; const_iterator &gt; const_reverse_iterator</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00101">vector_map.h:101</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_af086cceac199bd735c7a97c2a8d7ed21"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#af086cceac199bd735c7a97c2a8d7ed21">operations_research::VectorMap::rbegin</a></div><div class="ttdeci">const_reverse_iterator rbegin() const</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00104">vector_map.h:104</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a49b489a408a211a90e766329c0732d7b"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a49b489a408a211a90e766329c0732d7b">operations_research::VectorMap::size_type</a></div><div class="ttdeci">size_t size_type</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00097">vector_map.h:97</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a07da1fdc890b6949f1a20a1961c6fc44"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a07da1fdc890b6949f1a20a1961c6fc44">operations_research::VectorMap::rend</a></div><div class="ttdeci">const_reverse_iterator rend() const</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00107">vector_map.h:107</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1_vector_map_html_a4fef7a13b0a31eb10c0ae4c731a0e2d3"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a4fef7a13b0a31eb10c0ae4c731a0e2d3">operations_research::VectorMap::reference</a></div><div class="ttdeci">const T &amp; reference</div><div class="ttdef"><b>Definition:</b> <a href="vector__map_8h_source.html#l00095">vector_map.h:95</a></div></div>
<div class="ttc" id="anamespacegtl_html_aae28e97bd1fa93cb0032642550da7455"><div class="ttname"><a href="namespacegtl.html#aae28e97bd1fa93cb0032642550da7455">gtl::ContainsKey</a></div><div class="ttdeci">bool ContainsKey(const Collection &amp;collection, const Key &amp;key)</div><div class="ttdef"><b>Definition:</b> <a href="map__util_8h_source.html#l00170">map_util.h:170</a></div></div>
<!-- HTML footer for doxygen 1.8.18-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_a7cc1eeded8f693d0da6c729bc88c45a.html">ortools</a></li><li class="navelem"><a class="el" href="dir_a3328a0ea67a2aaa160c2783ffbaa5dc.html">util</a></li><li class="navelem"><a class="el" href="vector__map_8h.html">vector_map.h</a></li>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.20 </li>
</ul>
</div>
</body>
</html>