<ahref="stl__logging_8h.html">Go to the documentation of this file.</a><divclass="fragment"><divclass="line"><aid="l00001"name="l00001"></a><spanclass="lineno"> 1</span><spanclass="comment">// Copyright 2010-2021 Google LLC</span></div>
<divclass="line"><aid="l00002"name="l00002"></a><spanclass="lineno"> 2</span><spanclass="comment">// Licensed under the Apache License, Version 2.0 (the "License");</span></div>
<divclass="line"><aid="l00003"name="l00003"></a><spanclass="lineno"> 3</span><spanclass="comment">// you may not use this file except in compliance with the License.</span></div>
<divclass="line"><aid="l00004"name="l00004"></a><spanclass="lineno"> 4</span><spanclass="comment">// You may obtain a copy of the License at</span></div>
<divclass="line"><aid="l00008"name="l00008"></a><spanclass="lineno"> 8</span><spanclass="comment">// Unless required by applicable law or agreed to in writing, software</span></div>
<divclass="line"><aid="l00009"name="l00009"></a><spanclass="lineno"> 9</span><spanclass="comment">// distributed under the License is distributed on an "AS IS" BASIS,</span></div>
<divclass="line"><aid="l00010"name="l00010"></a><spanclass="lineno"> 10</span><spanclass="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<divclass="line"><aid="l00011"name="l00011"></a><spanclass="lineno"> 11</span><spanclass="comment">// See the License for the specific language governing permissions and</span></div>
<divclass="line"><aid="l00012"name="l00012"></a><spanclass="lineno"> 12</span><spanclass="comment">// limitations under the License.</span></div>
<divclass="line"><aid="l00030"name="l00030"></a><spanclass="lineno"> 30</span><spanclass="comment">// Forward declare these two, and define them after all the container streams</span></div>
<divclass="line"><aid="l00031"name="l00031"></a><spanclass="lineno"> 31</span><spanclass="comment">// operators so that we can recurse from pair -> container -> container -> pair</span></div>
<divclass="line"><aid="l00039"name="l00039"></a><spanclass="lineno"> 39</span><spanclass="keywordtype">void</span><aclass="code hl_function"href="namespacegoogle.html#ae631154cd9cf09cd2b9087903915cddf">PrintSequence</a>(std::ostream& out, Iter begin, Iter <aclass="code hl_variable"href="sparse__submatrix_8cc.html#a4d53eac2ef2732c28fa9fb663e0c19a7">end</a>);</div>
<divclass="line"><aid="l00058"name="l00058"></a><spanclass="lineno"> 58</span><spanclass="preprocessor"> template <class T1, class T2, class T3> \</span></div>
<divclass="line"><aid="l00071"name="l00071"></a><spanclass="lineno"> 71</span><spanclass="preprocessor"> template <class T1, class T2, class T3, class T4> \</span></div>
<divclass="line"><aid="l00086"name="l00086"></a><spanclass="lineno"> 86</span><spanclass="preprocessor"> template <class T1, class T2, class T3, class T4, class T5> \</span></div>
<divclass="line"><aid="l00108"name="l00108"></a><spanclass="lineno"><aclass="line"href="namespacegoogle.html#ae631154cd9cf09cd2b9087903915cddf"> 108</a></span><spanclass="keyword">inline</span><spanclass="keywordtype">void</span><aclass="code hl_function"href="namespacegoogle.html#ae631154cd9cf09cd2b9087903915cddf">PrintSequence</a>(std::ostream& out, Iter begin, Iter <aclass="code hl_variable"href="sparse__submatrix_8cc.html#a4d53eac2ef2732c28fa9fb663e0c19a7">end</a>) {</div>
<divclass="line"><aid="l00109"name="l00109"></a><spanclass="lineno"> 109</span><spanclass="comment">// Output at most 100 elements -- appropriate if used for logging.</span></div>
<divclass="line"><aid="l00110"name="l00110"></a><spanclass="lineno"> 110</span><spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> i = 0; begin != <aclass="code hl_variable"href="sparse__submatrix_8cc.html#a4d53eac2ef2732c28fa9fb663e0c19a7">end</a>&& i < 100; ++i, ++begin) {</div>
<divclass="line"><aid="l00111"name="l00111"></a><spanclass="lineno"> 111</span><spanclass="keywordflow">if</span> (i > 0) out <<<spanclass="charliteral">''</span>;</div>
<divclass="line"><aid="l00112"name="l00112"></a><spanclass="lineno"> 112</span> out << *begin;</div>
<divclass="line"><aid="l00121"name="l00121"></a><spanclass="lineno"> 121</span><spanclass="comment">// Note that this is technically undefined behavior! We are adding things into</span></div>
<divclass="line"><aid="l00122"name="l00122"></a><spanclass="lineno"> 122</span><spanclass="comment">// the std namespace for a reason though -- we are providing new operations on</span></div>
<divclass="line"><aid="l00123"name="l00123"></a><spanclass="lineno"> 123</span><spanclass="comment">// types which are themselves defined with this namespace. Without this, these</span></div>
<divclass="line"><aid="l00124"name="l00124"></a><spanclass="lineno"> 124</span><spanclass="comment">// operator overloads cannot be found via ADL. If these definitions are not</span></div>
<divclass="line"><aid="l00125"name="l00125"></a><spanclass="lineno"> 125</span><spanclass="comment">// found via ADL, they must be #included before they're used, which requires</span></div>
<divclass="line"><aid="l00126"name="l00126"></a><spanclass="lineno"> 126</span><spanclass="comment">// this header to be included before apparently independent other headers.</span></div>
<divclass="line"><aid="l00128"name="l00128"></a><spanclass="lineno"> 128</span><spanclass="comment">// For example, base/logging.h defines various template functions to implement</span></div>
<divclass="line"><aid="l00129"name="l00129"></a><spanclass="lineno"> 129</span><spanclass="comment">// CHECK_EQ(x, y) and stream x and y into the log in the event the check fails.</span></div>
<divclass="line"><aid="l00130"name="l00130"></a><spanclass="lineno"> 130</span><spanclass="comment">// It does so via the function template MakeCheckOpValueString:</span></div>
<divclass="line"><aid="l00135"name="l00135"></a><spanclass="lineno"> 135</span><spanclass="comment">// Because 'logging.h' is included before 'stl_logging.h',</span></div>
<divclass="line"><aid="l00136"name="l00136"></a><spanclass="lineno"> 136</span><spanclass="comment">// subsequent CHECK_EQ(v1, v2) for vector<...> typed variable v1 and v2 can only</span></div>
<divclass="line"><aid="l00137"name="l00137"></a><spanclass="lineno"> 137</span><spanclass="comment">// find these operator definitions via ADL.</span></div>
<divclass="line"><aid="l00139"name="l00139"></a><spanclass="lineno"> 139</span><spanclass="comment">// Even this solution has problems -- it may pull unintended operators into the</span></div>
<divclass="line"><aid="l00140"name="l00140"></a><spanclass="lineno"> 140</span><spanclass="comment">// namespace as well, allowing them to also be found via ADL, and creating code</span></div>
<divclass="line"><aid="l00141"name="l00141"></a><spanclass="lineno"> 141</span><spanclass="comment">// that only works with a particular order of includes. Long term, we need to</span></div>
<divclass="line"><aid="l00142"name="l00142"></a><spanclass="lineno"> 142</span><spanclass="comment">// move all of the *definitions* into namespace std, bet we need to ensure no</span></div>
<divclass="line"><aid="l00143"name="l00143"></a><spanclass="lineno"> 143</span><spanclass="comment">// one references them first. This lets us take that step. We cannot define them</span></div>
<divclass="line"><aid="l00144"name="l00144"></a><spanclass="lineno"> 144</span><spanclass="comment">// in both because that would create ambiguous overloads when both are found.</span></div>
<divclass="ttc"id="anamespacegoogle_html_ae631154cd9cf09cd2b9087903915cddf"><divclass="ttname"><ahref="namespacegoogle.html#ae631154cd9cf09cd2b9087903915cddf">google::PrintSequence</a></div><divclass="ttdeci">void PrintSequence(std::ostream &out, Iter begin, Iter end)</div><divclass="ttdef"><b>Definition:</b><ahref="stl__logging_8h_source.html#l00108">stl_logging.h:108</a></div></div>
<divclass="ttc"id="astl__logging_8h_html_a682a8f845c69fb4338ae7da571464daf"><divclass="ttname"><ahref="stl__logging_8h.html#a682a8f845c69fb4338ae7da571464daf">operator<<</a></div><divclass="ttdeci">std::ostream & operator<<(std::ostream &out, const std::pair< First, Second >&p)</div><divclass="ttdef"><b>Definition:</b><ahref="stl__logging_8h_source.html#l00099">stl_logging.h:99</a></div></div>