|
|
|
|
@@ -3,7 +3,7 @@
|
|
|
|
|
<head>
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
|
|
|
|
<meta name="generator" content="Doxygen 1.9.2"/>
|
|
|
|
|
<meta name="generator" content="Doxygen 1.9.3"/>
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
|
|
|
<title>Algorithms_in_C++: operations_on_datastructures Namespace Reference</title>
|
|
|
|
|
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
|
|
|
|
@@ -30,8 +30,8 @@ MathJax.Hub.Config({
|
|
|
|
|
<div id="titlearea">
|
|
|
|
|
<table cellspacing="0" cellpadding="0">
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr style="height: 56px;">
|
|
|
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
|
|
|
<tr id="projectrow">
|
|
|
|
|
<td id="projectalign">
|
|
|
|
|
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
|
|
|
|
@@ -41,7 +41,7 @@ MathJax.Hub.Config({
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- end header part -->
|
|
|
|
|
<!-- Generated by Doxygen 1.9.2 -->
|
|
|
|
|
<!-- 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');
|
|
|
|
|
@@ -177,29 +177,29 @@ Functions</h2></td></tr>
|
|
|
|
|
<p >< Add the element if it is unique</p>
|
|
|
|
|
<p >< Increment index of first array</p>
|
|
|
|
|
<p >< Increment index of second array too</p>
|
|
|
|
|
<div class="fragment"><div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> {</div>
|
|
|
|
|
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res; <span class="comment">///< Vector to hold the intersection</span></div>
|
|
|
|
|
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="keywordtype">size_t</span> f_index = 0; <span class="comment">///< Index for the first array</span></div>
|
|
|
|
|
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keywordtype">size_t</span> s_index = 0; <span class="comment">///< Index for the second array</span></div>
|
|
|
|
|
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keywordtype">size_t</span> f_length = first.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); <span class="comment">///< Length of first array</span></div>
|
|
|
|
|
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keywordtype">size_t</span> s_length = second.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); <span class="comment">///< Length of second array</span></div>
|
|
|
|
|
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> </div>
|
|
|
|
|
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <span class="keywordflow">while</span> (f_index < f_length && s_index < s_length) {</div>
|
|
|
|
|
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="keywordflow">if</span> (first[f_index] < second[s_index]) {</div>
|
|
|
|
|
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> f_index++; <span class="comment">///< Increment index of second array</span></div>
|
|
|
|
|
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (first[f_index] > second[s_index]) {</div>
|
|
|
|
|
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> s_index++; <span class="comment">///< Increment index of second array</span></div>
|
|
|
|
|
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> } <span class="keywordflow">else</span> {</div>
|
|
|
|
|
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keywordflow">if</span> ((res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() == 0) || (first[f_index] != res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/back.html">back</a>())) {</div>
|
|
|
|
|
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(</div>
|
|
|
|
|
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> first[f_index]); <span class="comment">///< Add the element if it is unique</span></div>
|
|
|
|
|
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> }</div>
|
|
|
|
|
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> f_index++; <span class="comment">///< Increment index of first array</span></div>
|
|
|
|
|
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> s_index++; <span class="comment">///< Increment index of second array too</span></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="keywordflow">return</span> res;</div>
|
|
|
|
|
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span>}</div>
|
|
|
|
|
<div class="fragment"><div class="line"><span class="lineno"> 50</span> {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 51</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res; <span class="comment">///< Vector to hold the intersection</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 52</span> <span class="keywordtype">size_t</span> f_index = 0; <span class="comment">///< Index for the first array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 53</span> <span class="keywordtype">size_t</span> s_index = 0; <span class="comment">///< Index for the second array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 54</span> <span class="keywordtype">size_t</span> f_length = first.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); <span class="comment">///< Length of first array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 55</span> <span class="keywordtype">size_t</span> s_length = second.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); <span class="comment">///< Length of second array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 56</span> </div>
|
|
|
|
|
<div class="line"><span class="lineno"> 57</span> <span class="keywordflow">while</span> (f_index < f_length && s_index < s_length) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 58</span> <span class="keywordflow">if</span> (first[f_index] < second[s_index]) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 59</span> f_index++; <span class="comment">///< Increment index of second array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 60</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (first[f_index] > second[s_index]) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 61</span> s_index++; <span class="comment">///< Increment index of second array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 62</span> } <span class="keywordflow">else</span> {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 63</span> <span class="keywordflow">if</span> ((res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() == 0) || (first[f_index] != res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/back.html">back</a>())) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 64</span> res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 65</span> first[f_index]); <span class="comment">///< Add the element if it is unique</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 66</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 67</span> f_index++; <span class="comment">///< Increment index of first array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 68</span> s_index++; <span class="comment">///< Increment index of second array too</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 69</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 70</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 71</span> <span class="keywordflow">return</span> res;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 72</span>}</div>
|
|
|
|
|
<div class="ttc" id="aback_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/back.html">std::vector::back</a></div><div class="ttdeci">T back(T... args)</div></div>
|
|
|
|
|
<div class="ttc" id="apush_back_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">std::vector::push_back</a></div><div class="ttdeci">T push_back(T... args)</div></div>
|
|
|
|
|
<div class="ttc" id="asize_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/size.html">std::vector::size</a></div><div class="ttdeci">T size(T... args)</div></div>
|
|
|
|
|
@@ -266,46 +266,46 @@ Here is the call graph for this function:</div>
|
|
|
|
|
<p >< Add the element if it is unique</p>
|
|
|
|
|
<p >< Add remaining elements</p>
|
|
|
|
|
<p >< Add the element if it is unique</p>
|
|
|
|
|
<div class="fragment"><div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> {</div>
|
|
|
|
|
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res; <span class="comment">///< Vector to hold the union</span></div>
|
|
|
|
|
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="keywordtype">size_t</span> f_index = 0; <span class="comment">///< Index for the first array</span></div>
|
|
|
|
|
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keywordtype">size_t</span> s_index = 0; <span class="comment">///< Index for the second array</span></div>
|
|
|
|
|
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keywordtype">size_t</span> f_length = first.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); <span class="comment">///< Length of first array</span></div>
|
|
|
|
|
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keywordtype">size_t</span> s_length = second.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); <span class="comment">///< Length of second array</span></div>
|
|
|
|
|
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> int32_t next = 0; <span class="comment">///< Integer to store value of the next element</span></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> <span class="keywordflow">while</span> (f_index < f_length && s_index < s_length) {</div>
|
|
|
|
|
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="keywordflow">if</span> (first[f_index] < second[s_index]) {</div>
|
|
|
|
|
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> next = first[f_index]; <span class="comment">///< Append from first array</span></div>
|
|
|
|
|
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> f_index++; <span class="comment">///< Increment index of second array</span></div>
|
|
|
|
|
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (first[f_index] > second[s_index]) {</div>
|
|
|
|
|
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> next = second[s_index]; <span class="comment">///< Append from second array</span></div>
|
|
|
|
|
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> s_index++; <span class="comment">///< Increment index of second array</span></div>
|
|
|
|
|
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> } <span class="keywordflow">else</span> {</div>
|
|
|
|
|
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/next.html">next</a> = first[f_index]; <span class="comment">///< Element is the same in both</span></div>
|
|
|
|
|
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> f_index++; <span class="comment">///< Increment index of first array</span></div>
|
|
|
|
|
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> s_index++; <span class="comment">///< Increment index of second array too</span></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> <span class="keywordflow">if</span> ((res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() == 0) || (next != res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/back.html">back</a>())) {</div>
|
|
|
|
|
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(next); <span class="comment">///< Add the element if it is unique</span></div>
|
|
|
|
|
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> }</div>
|
|
|
|
|
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> }</div>
|
|
|
|
|
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="keywordflow">while</span> (f_index < f_length) {</div>
|
|
|
|
|
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/next.html">next</a> = first[f_index]; <span class="comment">///< Add remaining elements</span></div>
|
|
|
|
|
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keywordflow">if</span> ((res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() == 0) || (next != res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/back.html">back</a>())) {</div>
|
|
|
|
|
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(next); <span class="comment">///< Add the element if it is unique</span></div>
|
|
|
|
|
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> }</div>
|
|
|
|
|
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> f_index++;</div>
|
|
|
|
|
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> }</div>
|
|
|
|
|
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="keywordflow">while</span> (s_index < s_length) {</div>
|
|
|
|
|
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/next.html">next</a> = second[s_index]; <span class="comment">///< Add remaining elements</span></div>
|
|
|
|
|
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <span class="keywordflow">if</span> ((res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() == 0) || (next != res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/back.html">back</a>())) {</div>
|
|
|
|
|
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(next); <span class="comment">///< Add the element if it is unique</span></div>
|
|
|
|
|
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> }</div>
|
|
|
|
|
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> s_index++;</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> <span class="keywordflow">return</span> res;</div>
|
|
|
|
|
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span>}</div>
|
|
|
|
|
<div class="fragment"><div class="line"><span class="lineno"> 50</span> {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 51</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res; <span class="comment">///< Vector to hold the union</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 52</span> <span class="keywordtype">size_t</span> f_index = 0; <span class="comment">///< Index for the first array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 53</span> <span class="keywordtype">size_t</span> s_index = 0; <span class="comment">///< Index for the second array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 54</span> <span class="keywordtype">size_t</span> f_length = first.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); <span class="comment">///< Length of first array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 55</span> <span class="keywordtype">size_t</span> s_length = second.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); <span class="comment">///< Length of second array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 56</span> int32_t next = 0; <span class="comment">///< Integer to store value of the next element</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 57</span> </div>
|
|
|
|
|
<div class="line"><span class="lineno"> 58</span> <span class="keywordflow">while</span> (f_index < f_length && s_index < s_length) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 59</span> <span class="keywordflow">if</span> (first[f_index] < second[s_index]) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 60</span> next = first[f_index]; <span class="comment">///< Append from first array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 61</span> f_index++; <span class="comment">///< Increment index of second array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 62</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (first[f_index] > second[s_index]) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 63</span> next = second[s_index]; <span class="comment">///< Append from second array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 64</span> s_index++; <span class="comment">///< Increment index of second array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 65</span> } <span class="keywordflow">else</span> {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 66</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/next.html">next</a> = first[f_index]; <span class="comment">///< Element is the same in both</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 67</span> f_index++; <span class="comment">///< Increment index of first array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 68</span> s_index++; <span class="comment">///< Increment index of second array too</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 69</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 70</span> <span class="keywordflow">if</span> ((res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() == 0) || (next != res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/back.html">back</a>())) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 71</span> res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(next); <span class="comment">///< Add the element if it is unique</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 72</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 73</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 74</span> <span class="keywordflow">while</span> (f_index < f_length) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 75</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/next.html">next</a> = first[f_index]; <span class="comment">///< Add remaining elements</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 76</span> <span class="keywordflow">if</span> ((res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() == 0) || (next != res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/back.html">back</a>())) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 77</span> res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(next); <span class="comment">///< Add the element if it is unique</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 78</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 79</span> f_index++;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 80</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 81</span> <span class="keywordflow">while</span> (s_index < s_length) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 82</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/next.html">next</a> = second[s_index]; <span class="comment">///< Add remaining elements</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 83</span> <span class="keywordflow">if</span> ((res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() == 0) || (next != res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/back.html">back</a>())) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 84</span> res.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(next); <span class="comment">///< Add the element if it is unique</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 85</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 86</span> s_index++;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 87</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 88</span> <span class="keywordflow">return</span> res;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 89</span>}</div>
|
|
|
|
|
<div class="ttc" id="anext_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/iterator/next.html">std::next</a></div><div class="ttdeci">T next(T... args)</div></div>
|
|
|
|
|
</div><!-- fragment --><div class="dynheader">
|
|
|
|
|
Here is the call graph for this function:</div>
|
|
|
|
|
@@ -354,12 +354,12 @@ Here is the call graph for this function:</div>
|
|
|
|
|
<p >Print newline</p>
|
|
|
|
|
<p >Print each value in the array</p>
|
|
|
|
|
<p >Print newline</p>
|
|
|
|
|
<div class="fragment"><div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> {</div>
|
|
|
|
|
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <span class="keywordflow">for</span> (int32_t i : array) {</div>
|
|
|
|
|
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << i << <span class="stringliteral">" "</span>; <span class="comment">/// Print each value in the array</span></div>
|
|
|
|
|
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> }</div>
|
|
|
|
|
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"\n"</span>; <span class="comment">/// Print newline</span></div>
|
|
|
|
|
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span>}</div>
|
|
|
|
|
<div class="fragment"><div class="line"><span class="lineno"> 29</span> {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 30</span> <span class="keywordflow">for</span> (int32_t i : array) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 31</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << i << <span class="stringliteral">" "</span>; <span class="comment">/// Print each value in the array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 32</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 33</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"\n"</span>; <span class="comment">/// Print newline</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 34</span>}</div>
|
|
|
|
|
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
|
|
|
|
|
</div><!-- fragment -->
|
|
|
|
|
</div>
|
|
|
|
|
@@ -403,20 +403,20 @@ Here is the call graph for this function:</div>
|
|
|
|
|
<p >< Result array</p>
|
|
|
|
|
<p >< Add values after the shift index</p>
|
|
|
|
|
<p >< Add the values from the start</p>
|
|
|
|
|
<div class="fragment"><div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> {</div>
|
|
|
|
|
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="keywordflow">if</span> (array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() <= shift) {</div>
|
|
|
|
|
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">return</span> {}; <span class="comment">///< We got an invalid shift, return empty array</span></div>
|
|
|
|
|
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> }</div>
|
|
|
|
|
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res(array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>()); <span class="comment">///< Result array</span></div>
|
|
|
|
|
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = shift; i < array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); i++) {</div>
|
|
|
|
|
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> res[i - shift] = array[i]; <span class="comment">///< Add values after the shift index</span></div>
|
|
|
|
|
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> }</div>
|
|
|
|
|
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < shift; i++) {</div>
|
|
|
|
|
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> res[array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() - shift + i] =</div>
|
|
|
|
|
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> array[i]; <span class="comment">///< Add the values from the start</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="keywordflow">return</span> res;</div>
|
|
|
|
|
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span>}</div>
|
|
|
|
|
<div class="fragment"><div class="line"><span class="lineno"> 47</span> {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 48</span> <span class="keywordflow">if</span> (array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() <= shift) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 49</span> <span class="keywordflow">return</span> {}; <span class="comment">///< We got an invalid shift, return empty array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 50</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 51</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res(array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>()); <span class="comment">///< Result array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 52</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = shift; i < array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); i++) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 53</span> res[i - shift] = array[i]; <span class="comment">///< Add values after the shift index</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 54</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 55</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < shift; i++) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 56</span> res[array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() - shift + i] =</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 57</span> array[i]; <span class="comment">///< Add the values from the start</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 58</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 59</span> <span class="keywordflow">return</span> res;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 60</span>}</div>
|
|
|
|
|
</div><!-- fragment --><div class="dynheader">
|
|
|
|
|
Here is the call graph for this function:</div>
|
|
|
|
|
<div class="dyncontent">
|
|
|
|
|
@@ -465,20 +465,20 @@ Here is the call graph for this function:</div>
|
|
|
|
|
<p >< Result array</p>
|
|
|
|
|
<p >< Add values after the shift index</p>
|
|
|
|
|
<p >< Add the values from the start</p>
|
|
|
|
|
<div class="fragment"><div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> {</div>
|
|
|
|
|
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">if</span> (array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() <= shift) {</div>
|
|
|
|
|
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordflow">return</span> {}; <span class="comment">///< We got an invalid shift, return empty array</span></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> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res(array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>()); <span class="comment">///< Result array</span></div>
|
|
|
|
|
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = shift; i < array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); i++) {</div>
|
|
|
|
|
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> res[i] = array[i - shift]; <span class="comment">///< Add values after the shift index</span></div>
|
|
|
|
|
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> }</div>
|
|
|
|
|
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < shift; i++) {</div>
|
|
|
|
|
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> res[i] =</div>
|
|
|
|
|
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> array[array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() - shift + i]; <span class="comment">///< Add the values from the start</span></div>
|
|
|
|
|
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> }</div>
|
|
|
|
|
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="keywordflow">return</span> res;</div>
|
|
|
|
|
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span>}</div>
|
|
|
|
|
<div class="fragment"><div class="line"><span class="lineno"> 48</span> {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 49</span> <span class="keywordflow">if</span> (array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() <= shift) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 50</span> <span class="keywordflow">return</span> {}; <span class="comment">///< We got an invalid shift, return empty array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 51</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 52</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res(array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>()); <span class="comment">///< Result array</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 53</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = shift; i < array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); i++) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 54</span> res[i] = array[i - shift]; <span class="comment">///< Add values after the shift index</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 55</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 56</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < shift; i++) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 57</span> res[i] =</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 58</span> array[array.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() - shift + i]; <span class="comment">///< Add the values from the start</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 59</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 60</span> <span class="keywordflow">return</span> res;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 61</span>}</div>
|
|
|
|
|
</div><!-- fragment --><div class="dynheader">
|
|
|
|
|
Here is the call graph for this function:</div>
|
|
|
|
|
<div class="dyncontent">
|
|
|
|
|
@@ -494,7 +494,7 @@ Here is the call graph for this function:</div>
|
|
|
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="navelem"><a class="el" href="../../da/d6d/namespaceoperations__on__datastructures.html">operations_on_datastructures</a></li>
|
|
|
|
|
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.2 </li>
|
|
|
|
|
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.3 </li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</body>
|
|
|
|
|
|