256 lines
43 KiB
HTML
256 lines
43 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.9.3"/>
|
|
<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
|
|
 <span id="projectnumber">9.3</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.9.3 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
|
|
/* @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:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(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:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(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 id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="comment">// Copyright 2010-2021 Google LLC</span></div>
|
|
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="comment">// Licensed under the Apache License, Version 2.0 (the "License");</span></div>
|
|
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="comment">// you may not use this file except in compliance with the License.</span></div>
|
|
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="comment">// You may obtain a copy of the License at</span></div>
|
|
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="comment">//</span></div>
|
|
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div>
|
|
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="comment">//</span></div>
|
|
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="comment">// Unless required by applicable law or agreed to in writing, software</span></div>
|
|
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="comment">// distributed under the License is distributed on an "AS IS" BASIS,</span></div>
|
|
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
|
|
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="comment">// See the License for the specific language governing permissions and</span></div>
|
|
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="comment">// limitations under the License.</span></div>
|
|
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> </div>
|
|
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="comment">// Vector with map from element to index in the vector.</span></div>
|
|
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> </div>
|
|
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#ifndef OR_TOOLS_UTIL_VECTOR_MAP_H_</span></div>
|
|
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#define OR_TOOLS_UTIL_VECTOR_MAP_H_</span></div>
|
|
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> </div>
|
|
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="preprocessor">#include <vector></span></div>
|
|
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> </div>
|
|
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="preprocessor">#include "absl/container/flat_hash_map.h"</span></div>
|
|
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="preprocessor">#include "<a class="code" href="map__util_8h.html">ortools/base/map_util.h</a>"</span></div>
|
|
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> </div>
|
|
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespaceoperations__research.html">operations_research</a> {</div>
|
|
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> </div>
|
|
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span><span class="comment">// This class stores a vector of distinct elements, as well as a map</span></div>
|
|
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span><span class="comment">// from elements to index to find the index in the vector.</span></div>
|
|
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span><span class="comment">// This is useful to store mapping between objects and indices.</span></div>
|
|
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span><span class="keyword">template</span> <<span class="keyword">class</span> T></div>
|
|
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html"> 30</a></span><span class="keyword">class </span><a class="code hl_class" href="classoperations__research_1_1_vector_map.html">VectorMap</a> {</div>
|
|
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="keyword">public</span>:</div>
|
|
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="comment">// Adds an element if not already present, and returns its index in</span></div>
|
|
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="comment">// the vector-map.</span></div>
|
|
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a1f665a2e76399cbf821a5ef03eb5d400"> 34</a></span> <span class="keywordtype">int</span> <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#a1f665a2e76399cbf821a5ef03eb5d400">Add</a>(<span class="keyword">const</span> T& element) {</div>
|
|
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="keywordtype">int</span> current_index = <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#af31997ebd277a4c0d81b30f7b793d65d">Index</a>(element);</div>
|
|
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keywordflow">if</span> (current_index != -1) {</div>
|
|
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <span class="keywordflow">return</span> current_index;</div>
|
|
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> }</div>
|
|
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code hl_variable" href="local__search_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a> = list_.size();</div>
|
|
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <a class="code hl_define" href="base_2logging_8h.html#a7c0ce053b28d53aa4eaf3eb7fb71663b">CHECK_EQ</a>(<a class="code hl_variable" href="local__search_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>, map_.size());</div>
|
|
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> list_.push_back(element);</div>
|
|
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> map_[element] = <a class="code hl_variable" href="local__search_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>;</div>
|
|
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keywordflow">return</span> <a class="code hl_variable" href="local__search_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>;</div>
|
|
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> }</div>
|
|
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <span class="comment">// TODO(user): Use ArraySlice.</span></div>
|
|
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> </div>
|
|
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="comment">// Adds all elements of the vector.</span></div>
|
|
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a9f752d420efd9bd451bed6759248617c"> 48</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#a9f752d420efd9bd451bed6759248617c">Add</a>(<span class="keyword">const</span> std::vector<T>& elements) {</div>
|
|
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < elements.size(); ++i) {</div>
|
|
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#a1f665a2e76399cbf821a5ef03eb5d400">Add</a>(elements[i]);</div>
|
|
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> }</div>
|
|
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> }</div>
|
|
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> </div>
|
|
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="comment">// Will return the index of the element if present, or die otherwise.</span></div>
|
|
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a907b6c90ba3b3598d306f5b7c30b5023"> 55</a></span> <span class="keywordtype">int</span> <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#a907b6c90ba3b3598d306f5b7c30b5023">IndexOrDie</a>(<span class="keyword">const</span> T& element)<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="keywordflow">return</span> <a class="code hl_function" href="namespacegtl.html#a73f41ac11336b94768fdd41594153d59">gtl::FindOrDie</a>(map_, element);</div>
|
|
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> }</div>
|
|
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> </div>
|
|
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="comment">// Returns -1 if the element is not in the vector, or its unique</span></div>
|
|
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="comment">// index if it is.</span></div>
|
|
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#af31997ebd277a4c0d81b30f7b793d65d"> 61</a></span> <span class="keywordtype">int</span> <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#af31997ebd277a4c0d81b30f7b793d65d">Index</a>(<span class="keyword">const</span> T& element)<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="keywordflow">return</span> <a class="code hl_function" href="namespacegtl.html#a795ebdb62731938c8c31b221f0f074b4">gtl::FindWithDefault</a>(map_, element, -1);</div>
|
|
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> }</div>
|
|
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="comment">// TODO(user): explore a int-type version.</span></div>
|
|
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> </div>
|
|
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <span class="comment">// Returns whether the element has already been added to the vector-map.</span></div>
|
|
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a4b9946b6fc9ff762ac72124ae91777bc"> 67</a></span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#a4b9946b6fc9ff762ac72124ae91777bc">Contains</a>(<span class="keyword">const</span> T& element)<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordflow">return</span> <a class="code hl_function" href="namespacegtl.html#aae28e97bd1fa93cb0032642550da7455">gtl::ContainsKey</a>(map_, element);</div>
|
|
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> }</div>
|
|
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> </div>
|
|
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <span class="comment">// Returns the element at position index.</span></div>
|
|
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a194e22db912c981e4406ceb01d5bb248"> 72</a></span> <span class="keyword">const</span> T& <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#a194e22db912c981e4406ceb01d5bb248">Element</a>(<span class="keywordtype">int</span> <a class="code hl_variable" href="local__search_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>)<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <a class="code hl_define" href="base_2logging_8h.html#a7cc25402ecd7591b4c39934dd656b1f9">CHECK_GE</a>(<a class="code hl_variable" href="local__search_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>, 0);</div>
|
|
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <a class="code hl_define" href="base_2logging_8h.html#a4bd2e815ca2f702a4b6aa744b1ff3b82">CHECK_LT</a>(<a class="code hl_variable" href="local__search_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>, list_.size());</div>
|
|
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <span class="keywordflow">return</span> list_[<a class="code hl_variable" href="local__search_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>];</div>
|
|
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> }</div>
|
|
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> </div>
|
|
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a1e6a80b4bd5602e71351fb6aaffcbb58"> 78</a></span> <span class="keyword">const</span> T& <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#a1e6a80b4bd5602e71351fb6aaffcbb58">operator[]</a>(<span class="keywordtype">int</span> <a class="code hl_variable" href="local__search_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#a194e22db912c981e4406ceb01d5bb248">Element</a>(<a class="code hl_variable" href="local__search_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a>); }</div>
|
|
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
|
|
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="comment">// Returns the number of distinct elements added to the vector-map.</span></div>
|
|
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#af9593d4a5ff4274efaf429cb4f9e57cc"> 81</a></span> <span class="keywordtype">int</span> <a class="code hl_function" 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 id="l00082" name="l00082"></a><span class="lineno"> 82</span> </div>
|
|
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <span class="comment">// Clears all the elements added to the vector-map.</span></div>
|
|
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#ac8bb3912a3ce86b15842e79d0b421204"> 84</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#ac8bb3912a3ce86b15842e79d0b421204">clear</a>() {</div>
|
|
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> list_.clear();</div>
|
|
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> map_.clear();</div>
|
|
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> }</div>
|
|
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> </div>
|
|
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <span class="comment">// Returns a read-only access to the vector of elements.</span></div>
|
|
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a01123839a811081bf4f4cb7967fc11f5"> 90</a></span> <span class="keyword">const</span> std::vector<T>& <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#a01123839a811081bf4f4cb7967fc11f5">list</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> list_; }</div>
|
|
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> </div>
|
|
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="comment">// Standard STL container boilerplate.</span></div>
|
|
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a265a253612b46abed17c61b0a5e5ce30"> 93</a></span> <span class="keyword">typedef</span> T <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#a265a253612b46abed17c61b0a5e5ce30">value_type</a>;</div>
|
|
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a2950e0a6095bb531a38185d9cb47f7e6"> 94</a></span> <span class="keyword">typedef</span> <span class="keyword">const</span> T* <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#a2950e0a6095bb531a38185d9cb47f7e6">pointer</a>;</div>
|
|
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a4fef7a13b0a31eb10c0ae4c731a0e2d3"> 95</a></span> <span class="keyword">typedef</span> <span class="keyword">const</span> T& <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#a4fef7a13b0a31eb10c0ae4c731a0e2d3">reference</a>;</div>
|
|
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#af9ba3e25df088c62f7d535b91672cda9"> 96</a></span> <span class="keyword">typedef</span> <span class="keyword">const</span> T& <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#af9ba3e25df088c62f7d535b91672cda9">const_reference</a>;</div>
|
|
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a49b489a408a211a90e766329c0732d7b"> 97</a></span> <span class="keyword">typedef</span> <span class="keywordtype">size_t</span> <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#a49b489a408a211a90e766329c0732d7b">size_type</a>;</div>
|
|
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#acf947bbb9e09f863cc3572ff8550b183"> 98</a></span> <span class="keyword">typedef</span> ptrdiff_t <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#acf947bbb9e09f863cc3572ff8550b183">difference_type</a>;</div>
|
|
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#ab87de14283f53f998f4113b7d96f33b1"> 99</a></span> <span class="keyword">static</span> <span class="keyword">const</span> <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#a49b489a408a211a90e766329c0732d7b">size_type</a> <a class="code hl_variable" href="classoperations__research_1_1_vector_map.html#ab87de14283f53f998f4113b7d96f33b1">npos</a>;</div>
|
|
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a2fc97dce62b7053449cc868607540dba"> 100</a></span> <span class="keyword">typedef</span> <span class="keyword">const</span> T* <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#a2fc97dce62b7053449cc868607540dba">const_iterator</a>;</div>
|
|
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a421ef78ccdc84f0f6b2b14e2732527ba"> 101</a></span> <span class="keyword">typedef</span> std::reverse_iterator<const_iterator> <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#a421ef78ccdc84f0f6b2b14e2732527ba">const_reverse_iterator</a>;</div>
|
|
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a29305669b60ca1680752e2fc3592ba99"> 102</a></span> <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#a2fc97dce62b7053449cc868607540dba">const_iterator</a> <a class="code hl_function" 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 id="l00103" name="l00103"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#accf9a4bd0c34d4a5f6a7dab66ea10cdc"> 103</a></span> <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#a2fc97dce62b7053449cc868607540dba">const_iterator</a> <a class="code hl_function" 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 id="l00104" name="l00104"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#af086cceac199bd735c7a97c2a8d7ed21"> 104</a></span> <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#a421ef78ccdc84f0f6b2b14e2732527ba">const_reverse_iterator</a> <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#af086cceac199bd735c7a97c2a8d7ed21">rbegin</a>()<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#a421ef78ccdc84f0f6b2b14e2732527ba">const_reverse_iterator</a>(list_.data() + list_.size());</div>
|
|
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> }</div>
|
|
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_vector_map.html#a07da1fdc890b6949f1a20a1961c6fc44"> 107</a></span> <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#a421ef78ccdc84f0f6b2b14e2732527ba">const_reverse_iterator</a> <a class="code hl_function" href="classoperations__research_1_1_vector_map.html#a07da1fdc890b6949f1a20a1961c6fc44">rend</a>()<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="classoperations__research_1_1_vector_map.html#a421ef78ccdc84f0f6b2b14e2732527ba">const_reverse_iterator</a>(list_.data());</div>
|
|
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> }</div>
|
|
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> </div>
|
|
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <span class="keyword">private</span>:</div>
|
|
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> std::vector<T> list_;</div>
|
|
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> absl::flat_hash_map<T, int> map_;</div>
|
|
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span>};</div>
|
|
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> </div>
|
|
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span>} <span class="comment">// namespace operations_research</span></div>
|
|
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span><span class="preprocessor">#endif </span><span class="comment">// OR_TOOLS_UTIL_VECTOR_MAP_H_</span></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#l00706">base/logging.h:706</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#l00703">base/logging.h:703</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#l00707">base/logging.h:707</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_a01123839a811081bf4f4cb7967fc11f5"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a01123839a811081bf4f4cb7967fc11f5">operations_research::VectorMap::list</a></div><div class="ttdeci">const std::vector< T > & 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="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_a194e22db912c981e4406ceb01d5bb248"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a194e22db912c981e4406ceb01d5bb248">operations_research::VectorMap::Element</a></div><div class="ttdeci">const T & 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_a1e6a80b4bd5602e71351fb6aaffcbb58"><div class="ttname"><a href="classoperations__research_1_1_vector_map.html#a1e6a80b4bd5602e71351fb6aaffcbb58">operations_research::VectorMap::operator[]</a></div><div class="ttdeci">const T & 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="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 &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_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_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="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_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_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< const_iterator > 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_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_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 &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_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 & 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="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 &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_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< T > &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="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="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_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_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="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_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 &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_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_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 & 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="alocal__search_8cc_html_a750b5d744c39a06bfb13e6eb010e35d0"><div class="ttname"><a href="local__search_8cc.html#a750b5d744c39a06bfb13e6eb010e35d0">index</a></div><div class="ttdeci">int index</div><div class="ttdef"><b>Definition:</b> <a href="local__search_8cc_source.html#l02750">local_search.cc:2750</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="anamespacegtl_html_a73f41ac11336b94768fdd41594153d59"><div class="ttname"><a href="namespacegtl.html#a73f41ac11336b94768fdd41594153d59">gtl::FindOrDie</a></div><div class="ttdeci">const Collection::value_type::second_type & FindOrDie(const Collection &collection, const typename Collection::value_type::first_type &key)</div><div class="ttdef"><b>Definition:</b> <a href="map__util_8h_source.html#l00206">map_util.h:206</a></div></div>
|
|
<div class="ttc" id="anamespacegtl_html_a795ebdb62731938c8c31b221f0f074b4"><div class="ttname"><a href="namespacegtl.html#a795ebdb62731938c8c31b221f0f074b4">gtl::FindWithDefault</a></div><div class="ttdeci">const Collection::value_type::second_type & FindWithDefault(const Collection &collection, const typename Collection::value_type::first_type &key, const typename Collection::value_type::second_type &value)</div><div class="ttdef"><b>Definition:</b> <a href="map__util_8h_source.html#l00029">map_util.h:29</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 &collection, const Key &key)</div><div class="ttdef"><b>Definition:</b> <a href="map__util_8h_source.html#l00200">map_util.h:200</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">Collection of objects used to extend the Constraint Solver library.</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><!-- fragment --></div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- 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.9.3 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|