diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-12-26 20:44:10 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-12-26 20:58:37 -0800 |
commit | 201458e3bd2f1d79a0ea0b853552e9df267e92b1 (patch) | |
tree | 0a4f13662cde7f92ae0bcf641c9733e2a0fcd6ef /html/001help.cc.html | |
parent | e35c2d6857e1ed916221faae707e3c53ff8ed042 (diff) | |
download | mu-201458e3bd2f1d79a0ea0b853552e9df267e92b1.tar.gz |
3713 - cross-link calls with definitions in html
Diffstat (limited to 'html/001help.cc.html')
-rw-r--r-- | html/001help.cc.html | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/html/001help.cc.html b/html/001help.cc.html index 5ce44e6b..3c853458 100644 --- a/html/001help.cc.html +++ b/html/001help.cc.html @@ -61,7 +61,7 @@ if ('onhashchange' in window) { <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: This should give you a sense for what to look forward to in later layers.</span> <span id="L3" class="LineNr"> 3 </span> <span id="L4" class="LineNr"> 4 </span><span class="Delimiter">:(before "End Commandline Parsing")</span> -<span id="L5" class="LineNr"> 5 </span><span class="Normal">if</span> <span class="Delimiter">(</span>argc <= <span class="Constant">1</span> || is_equal<span class="Delimiter">(</span>argv[<span class="Constant">1</span>]<span class="Delimiter">,</span> <span class="Constant">"--help"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L5" class="LineNr"> 5 </span><span class="Normal">if</span> <span class="Delimiter">(</span>argc <= <span class="Constant">1</span> || <a href='001help.cc.html#L70'>is_equal</a><span class="Delimiter">(</span>argv[<span class="Constant">1</span>]<span class="Delimiter">,</span> <span class="Constant">"--help"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L6" class="LineNr"> 6 </span> <span class="Comment">//: this is the functionality later layers will provide</span> <span id="L7" class="LineNr"> 7 </span> <span class="Comment">// currently no automated tests for commandline arg parsing</span> <span id="L8" class="LineNr"> 8 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>argc <= <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -77,16 +77,16 @@ if ('onhashchange' in window) { <span id="L18" class="LineNr"> 18 </span> << <span class="Constant">"Examples:</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L19" class="LineNr"> 19 </span> << <span class="Constant">" To load files and run 'main':</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L20" class="LineNr"> 20 </span> << <span class="Constant">" mu file1.mu file2.mu ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L21" class="LineNr"> 21 </span> << <span class="Constant">" To run 'main' and dump a trace of all operations at the end:</span><span class="cSpecial">\n</span><span class="Constant">"</span> +<span id="L21" class="LineNr"> 21 </span> << <span class="Constant">" To run 'main' and dump a <a href='003trace.cc.html#L171'>trace</a> of all operations at the <a href='003trace.cc.html#L195'>end</a>:</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L22" class="LineNr"> 22 </span> << <span class="Constant">" mu --trace file1.mu file2.mu ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L23" class="LineNr"> 23 </span> << <span class="Constant">" To run all tests:</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L24" class="LineNr"> 24 </span> << <span class="Constant">" mu test</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L25" class="LineNr"> 25 </span> << <span class="Constant">" To load files and then run all tests:</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L26" class="LineNr"> 26 </span> << <span class="Constant">" mu test file1.mu file2.mu ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L27" class="LineNr"> 27 </span> << <span class="Constant">" To run a single Mu scenario:</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L28" class="LineNr"> 28 </span> << <span class="Constant">" mu test file1.mu file2.mu ... scenario</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L29" class="LineNr"> 29 </span> << <span class="Constant">" To run a single Mu scenario and dump a trace at the end:</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L30" class="LineNr"> 30 </span> << <span class="Constant">" mu --trace test file1.mu file2.mu ... scenario</span><span class="cSpecial">\n</span><span class="Constant">"</span> +<span id="L27" class="LineNr"> 27 </span> << <span class="Constant">" To run a single Mu <a href='050scenario.cc.html#L57'>scenario</a>:</span><span class="cSpecial">\n</span><span class="Constant">"</span> +<span id="L28" class="LineNr"> 28 </span> << <span class="Constant">" mu test file1.mu file2.mu ... <a href='050scenario.cc.html#L57'>scenario</a></span><span class="cSpecial">\n</span><span class="Constant">"</span> +<span id="L29" class="LineNr"> 29 </span> << <span class="Constant">" To run a single Mu <a href='050scenario.cc.html#L57'>scenario</a> and dump a <a href='003trace.cc.html#L171'>trace</a> at the <a href='003trace.cc.html#L195'>end</a>:</span><span class="cSpecial">\n</span><span class="Constant">"</span> +<span id="L30" class="LineNr"> 30 </span> << <span class="Constant">" mu --trace test file1.mu file2.mu ... <a href='050scenario.cc.html#L57'>scenario</a></span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L31" class="LineNr"> 31 </span> << <span class="Constant">" To load files and run only the tests in explicitly loaded files (for apps):</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L32" class="LineNr"> 32 </span> << <span class="Constant">" mu --test-only-app test file1.mu file2.mu ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L33" class="LineNr"> 33 </span> << <span class="Constant">" To load all files with a numeric prefix in a directory:</span><span class="cSpecial">\n</span><span class="Constant">"</span> @@ -96,7 +96,7 @@ if ('onhashchange' in window) { <span id="L37" class="LineNr"> 37 </span> << <span class="Constant">" To pass ingredients to a mu program, provide them after '--':</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L38" class="LineNr"> 38 </span> << <span class="Constant">" mu file_or_dir1 file_or_dir2 ... -- ingredient1 ingredient2 ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L39" class="LineNr"> 39 </span> << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L40" class="LineNr"> 40 </span> << <span class="Constant">" To browse a trace generated by a previous run:</span><span class="cSpecial">\n</span><span class="Constant">"</span> +<span id="L40" class="LineNr"> 40 </span> << <span class="Constant">" To browse a <a href='003trace.cc.html#L171'>trace</a> generated by a previous run:</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L41" class="LineNr"> 41 </span> << <span class="Constant">" mu browse-trace file</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span id="L42" class="LineNr"> 42 </span> <span class="Delimiter">;</span> <span id="L43" class="LineNr"> 43 </span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> @@ -107,7 +107,7 @@ if ('onhashchange' in window) { <span id="L48" class="LineNr"> 48 </span><span class="Comment">//: option will never follow a non-option.</span> <span id="L49" class="LineNr"> 49 </span><span class="Delimiter">:(before "End Commandline Parsing")</span> <span id="L50" class="LineNr"> 50 </span><span class="Normal">char</span>** arg = &argv[<span class="Constant">1</span>]<span class="Delimiter">;</span> -<span id="L51" class="LineNr"> 51 </span><span class="Normal">while</span> <span class="Delimiter">(</span>argc > <span class="Constant">1</span> && starts_with<span class="Delimiter">(</span>*arg<span class="Delimiter">,</span> <span class="Constant">"--"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L51" class="LineNr"> 51 </span><span class="Normal">while</span> <span class="Delimiter">(</span>argc > <span class="Constant">1</span> && <a href='001help.cc.html#L74'>starts_with</a><span class="Delimiter">(</span>*arg<span class="Delimiter">,</span> <span class="Constant">"--"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L52" class="LineNr"> 52 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Constant">false</span><span class="Delimiter">)</span> <span id="L53" class="LineNr"> 53 </span> <span class="Delimiter">;</span> <span class="Comment">// no-op branch just so any further additions can consistently always start with 'else'</span> <span id="L54" class="LineNr"> 54 </span> <span class="Comment">// End Commandline Options(*arg)</span> @@ -126,15 +126,15 @@ if ('onhashchange' in window) { <span id="L67" class="LineNr"> 67 </span><span class="Comment">//: way, our 'build' script contains a little command to automatically</span> <span id="L68" class="LineNr"> 68 </span><span class="Comment">//: generate declarations for them.</span> <span id="L69" class="LineNr"> 69 </span><span class="Delimiter">:(code)</span> -<span id="L70" class="LineNr"> 70 </span><span class="Normal">bool</span> is_equal<span class="Delimiter">(</span><span class="Normal">char</span>* s<span class="Delimiter">,</span> <span class="Normal">const</span> <span class="Normal">char</span>* lit<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L70" class="LineNr"> 70 </span><span class="Normal">bool</span> <a href='001help.cc.html#L70'>is_equal</a><span class="Delimiter">(</span><span class="Normal">char</span>* s<span class="Delimiter">,</span> <span class="Normal">const</span> <span class="Normal">char</span>* lit<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L71" class="LineNr"> 71 </span> <span class="Identifier">return</span> strncmp<span class="Delimiter">(</span>s<span class="Delimiter">,</span> lit<span class="Delimiter">,</span> strlen<span class="Delimiter">(</span>lit<span class="Delimiter">))</span> == <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L72" class="LineNr"> 72 </span><span class="Delimiter">}</span> <span id="L73" class="LineNr"> 73 </span> -<span id="L74" class="LineNr"> 74 </span><span class="Normal">bool</span> starts_with<span class="Delimiter">(</span><span class="Normal">const</span> string& s<span class="Delimiter">,</span> <span class="Normal">const</span> string& pat<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L74" class="LineNr"> 74 </span><span class="Normal">bool</span> <a href='001help.cc.html#L74'>starts_with</a><span class="Delimiter">(</span><span class="Normal">const</span> string& s<span class="Delimiter">,</span> <span class="Normal">const</span> string& pat<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L75" class="LineNr"> 75 </span> string::const_iterator a=s<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> b=pat<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> -<span id="L76" class="LineNr"> 76 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">nada</span><span class="Comment">*/</span><span class="Delimiter">;</span> a!=s<span class="Delimiter">.</span>end<span class="Delimiter">()</span> && b!=pat<span class="Delimiter">.</span>end<span class="Delimiter">();</span> ++a<span class="Delimiter">,</span> ++b<span class="Delimiter">)</span> +<span id="L76" class="LineNr"> 76 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">nada</span><span class="Comment">*/</span><span class="Delimiter">;</span> a!=s<span class="Delimiter">.</span><a href='003trace.cc.html#L195'>end</a><span class="Delimiter">()</span> && b!=pat<span class="Delimiter">.</span><a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> ++a<span class="Delimiter">,</span> ++b<span class="Delimiter">)</span> <span id="L77" class="LineNr"> 77 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*a != *b<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> -<span id="L78" class="LineNr"> 78 </span> <span class="Identifier">return</span> b == pat<span class="Delimiter">.</span>end<span class="Delimiter">();</span> +<span id="L78" class="LineNr"> 78 </span> <span class="Identifier">return</span> b == pat<span class="Delimiter">.</span><a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L79" class="LineNr"> 79 </span><span class="Delimiter">}</span> <span id="L80" class="LineNr"> 80 </span> <span id="L81" class="LineNr"> 81 </span><span class="Comment">//: I'll throw some style conventions here for want of a better place for them.</span> @@ -200,20 +200,20 @@ if ('onhashchange' in window) { <span id="L141" class="LineNr">141 </span><span class="Comment">//: to the compiler, supported by Clang (GCC version only works sometimes:</span> <span id="L142" class="LineNr">142 </span><span class="Comment">//: <a href="http://stackoverflow.com/questions/20851061/how-to-make-gcc-ftrapv-work).">http://stackoverflow.com/questions/20851061/how-to-make-gcc-ftrapv-work).</a></span> <span id="L143" class="LineNr">143 </span><span class="Delimiter">:(before "atexit(teardown)")</span> -<span id="L144" class="LineNr">144 </span>initialize_signal_handlers<span class="Delimiter">();</span> <span class="Comment">// not always necessary, but doesn't hurt</span> +<span id="L144" class="LineNr">144 </span><a href='001help.cc.html#L149'>initialize_signal_handlers</a><span class="Delimiter">();</span> <span class="Comment">// not always necessary, but doesn't hurt</span> <span id="L145" class="LineNr">145 </span><span class="CommentedCode">//? cerr << INT_MAX+1 << '\n'; // test overflow</span> <span id="L146" class="LineNr">146 </span><span class="CommentedCode">//? assert(false); // test SIGABRT</span> <span id="L147" class="LineNr">147 </span><span class="Delimiter">:(code)</span> <span id="L148" class="LineNr">148 </span><span class="Comment">// based on <a href="https://spin.atomicobject.com/2013/01/13/exceptions-stack-traces-c">https://spin.atomicobject.com/2013/01/13/exceptions-stack-traces-c</a></span> -<span id="L149" class="LineNr">149 </span><span class="Normal">void</span> initialize_signal_handlers<span class="Delimiter">()</span> <span class="Delimiter">{</span> +<span id="L149" class="LineNr">149 </span><span class="Normal">void</span> <a href='001help.cc.html#L149'>initialize_signal_handlers</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L150" class="LineNr">150 </span> <span class="Normal">struct</span> sigaction action<span class="Delimiter">;</span> <span id="L151" class="LineNr">151 </span> bzero<span class="Delimiter">(</span>&action<span class="Delimiter">,</span> <span class="Normal">sizeof</span><span class="Delimiter">(</span>action<span class="Delimiter">));</span> -<span id="L152" class="LineNr">152 </span> action<span class="Delimiter">.</span>sa_sigaction = dump_and_exit<span class="Delimiter">;</span> +<span id="L152" class="LineNr">152 </span> action<span class="Delimiter">.</span>sa_sigaction = <a href='001help.cc.html#L157'>dump_and_exit</a><span class="Delimiter">;</span> <span id="L153" class="LineNr">153 </span> sigemptyset<span class="Delimiter">(</span>&action<span class="Delimiter">.</span>sa_mask<span class="Delimiter">);</span> <span id="L154" class="LineNr">154 </span> sigaction<span class="Delimiter">(</span><span class="Constant">SIGABRT</span><span class="Delimiter">,</span> &action<span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">);</span> <span class="Comment">// assert() failure or integer overflow on linux (with -ftrapv)</span> <span id="L155" class="LineNr">155 </span> sigaction<span class="Delimiter">(</span><span class="Constant">SIGILL</span><span class="Delimiter">,</span> &action<span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">);</span> <span class="Comment">// integer overflow on OS X (with -ftrapv)</span> <span id="L156" class="LineNr">156 </span><span class="Delimiter">}</span> -<span id="L157" class="LineNr">157 </span><span class="Normal">void</span> dump_and_exit<span class="Delimiter">(</span><span class="Normal">int</span> sig<span class="Delimiter">,</span> unused siginfo_t* dummy1<span class="Delimiter">,</span> unused <span class="Normal">void</span>* dummy2<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L157" class="LineNr">157 </span><span class="Normal">void</span> <a href='001help.cc.html#L157'>dump_and_exit</a><span class="Delimiter">(</span><span class="Normal">int</span> sig<span class="Delimiter">,</span> <a href='001help.cc.html#L255'>unused</a> siginfo_t* dummy1<span class="Delimiter">,</span> <a href='001help.cc.html#L255'>unused</a> <span class="Normal">void</span>* dummy2<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L158" class="LineNr">158 </span> <span class="Normal">switch</span> <span class="Delimiter">(</span>sig<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L159" class="LineNr">159 </span> <span class="Normal">case</span> <span class="Constant">SIGABRT</span>: <span id="L160" class="LineNr">160 </span><span class="PreProc"> #ifndef __APPLE__</span> @@ -236,7 +236,7 @@ if ('onhashchange' in window) { <span id="L177" class="LineNr">177 </span> <span id="L178" class="LineNr">178 </span><span class="Comment">//: For good measure we'll also enable SIGFPE.</span> <span id="L179" class="LineNr">179 </span><span class="Delimiter">:(before "atexit(teardown)")</span> -<span id="L180" class="LineNr">180 </span>feenableexcept<span class="Delimiter">(</span>FE_OVERFLOW | FE_UNDERFLOW<span class="Delimiter">);</span> +<span id="L180" class="LineNr">180 </span><a href='001help.cc.html#L193'>feenableexcept</a><span class="Delimiter">(</span>FE_OVERFLOW | FE_UNDERFLOW<span class="Delimiter">);</span> <span id="L181" class="LineNr">181 </span><span class="CommentedCode">//? assert(sizeof(int) == 4 && sizeof(float) == 4);</span> <span id="L182" class="LineNr">182 </span><span class="CommentedCode">//? // | exp | mantissa</span> <span id="L183" class="LineNr">183 </span><span class="CommentedCode">//? int smallest_subnormal = 0b00000000000000000000000000000001;</span> @@ -249,7 +249,7 @@ if ('onhashchange' in window) { <span id="L190" class="LineNr">190 </span><span class="PreProc">#ifdef __APPLE__</span> <span id="L191" class="LineNr">191 </span><span class="Comment">// Public domain polyfill for feenableexcept on OS X</span> <span id="L192" class="LineNr">192 </span><span class="Comment">// <a href="http://www-personal.umich.edu/~williams/archive/computation/fe-handling-example.c">http://www-personal.umich.edu/~williams/archive/computation/fe-handling-example.c</a></span> -<span id="L193" class="LineNr">193 </span><span class="Normal">int</span> feenableexcept <span class="Delimiter">(</span><span class="Normal">unsigned</span> <span class="Normal">int</span> excepts<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L193" class="LineNr">193 </span><span class="Normal">int</span> <a href='001help.cc.html#L193'>feenableexcept</a> <span class="Delimiter">(</span><span class="Normal">unsigned</span> <span class="Normal">int</span> excepts<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L194" class="LineNr">194 </span> <span class="Normal">static</span> fenv_t fenv<span class="Delimiter">;</span> <span id="L195" class="LineNr">195 </span> <span class="Normal">unsigned</span> <span class="Normal">int</span> new_excepts = excepts & FE_ALL_EXCEPT<span class="Delimiter">;</span> <span id="L196" class="LineNr">196 </span> <span class="Normal">unsigned</span> <span class="Normal">int</span> old_excepts<span class="Delimiter">;</span> @@ -266,22 +266,22 @@ if ('onhashchange' in window) { <span id="L207" class="LineNr">207 </span><span class="Comment">// from <a href="http://stackoverflow.com/questions/152643/idiomatic-c-for-reading-from-a-const-map">http://stackoverflow.com/questions/152643/idiomatic-c-for-reading-from-a-const-map</a></span> <span id="L208" class="LineNr">208 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">typename</span> T::mapped_type& get<span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L209" class="LineNr">209 </span> <span class="Normal">typename</span> T::iterator iter<span class="Delimiter">(</span>map<span class="Delimiter">.</span>find<span class="Delimiter">(</span>key<span class="Delimiter">));</span> -<span id="L210" class="LineNr">210 </span> assert<span class="Delimiter">(</span>iter != map<span class="Delimiter">.</span>end<span class="Delimiter">());</span> +<span id="L210" class="LineNr">210 </span> assert<span class="Delimiter">(</span>iter != map<span class="Delimiter">.</span><a href='003trace.cc.html#L195'>end</a><span class="Delimiter">());</span> <span id="L211" class="LineNr">211 </span> <span class="Identifier">return</span> iter<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L212" class="LineNr">212 </span><span class="Delimiter">}</span> <span id="L213" class="LineNr">213 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">typename</span> T::mapped_type <span class="Normal">const</span>& get<span class="Delimiter">(</span><span class="Normal">const</span> T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L214" class="LineNr">214 </span> <span class="Normal">typename</span> T::const_iterator iter<span class="Delimiter">(</span>map<span class="Delimiter">.</span>find<span class="Delimiter">(</span>key<span class="Delimiter">));</span> -<span id="L215" class="LineNr">215 </span> assert<span class="Delimiter">(</span>iter != map<span class="Delimiter">.</span>end<span class="Delimiter">());</span> +<span id="L215" class="LineNr">215 </span> assert<span class="Delimiter">(</span>iter != map<span class="Delimiter">.</span><a href='003trace.cc.html#L195'>end</a><span class="Delimiter">());</span> <span id="L216" class="LineNr">216 </span> <span class="Identifier">return</span> iter<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L217" class="LineNr">217 </span><span class="Delimiter">}</span> -<span id="L218" class="LineNr">218 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">typename</span> T::mapped_type <span class="Normal">const</span>& put<span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">,</span> <span class="Normal">typename</span> T::mapped_type <span class="Normal">const</span>& value<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L218" class="LineNr">218 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">typename</span> T::mapped_type <span class="Normal">const</span>& <a href='001help.cc.html#L218'>put</a><span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">,</span> <span class="Normal">typename</span> T::mapped_type <span class="Normal">const</span>& value<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L219" class="LineNr">219 </span> map[key] = value<span class="Delimiter">;</span> <span id="L220" class="LineNr">220 </span> <span class="Identifier">return</span> map[key]<span class="Delimiter">;</span> <span id="L221" class="LineNr">221 </span><span class="Delimiter">}</span> <span id="L222" class="LineNr">222 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">bool</span> contains_key<span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L223" class="LineNr">223 </span> <span class="Identifier">return</span> map<span class="Delimiter">.</span>find<span class="Delimiter">(</span>key<span class="Delimiter">)</span> != map<span class="Delimiter">.</span>end<span class="Delimiter">();</span> +<span id="L223" class="LineNr">223 </span> <span class="Identifier">return</span> map<span class="Delimiter">.</span>find<span class="Delimiter">(</span>key<span class="Delimiter">)</span> != map<span class="Delimiter">.</span><a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L224" class="LineNr">224 </span><span class="Delimiter">}</span> -<span id="L225" class="LineNr">225 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">typename</span> T::mapped_type& get_or_insert<span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L225" class="LineNr">225 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">typename</span> T::mapped_type& <a href='001help.cc.html#L225'>get_or_insert</a><span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L226" class="LineNr">226 </span> <span class="Identifier">return</span> map[key]<span class="Delimiter">;</span> <span id="L227" class="LineNr">227 </span><span class="Delimiter">}</span> <span id="L228" class="LineNr">228 </span><span class="Comment">//: The contract: any container that relies on get_or_insert should never call</span> @@ -291,7 +291,7 @@ if ('onhashchange' in window) { <span id="L232" class="LineNr">232 </span><span class="Comment">//: what subclass you try to putback into. You have to watch out for the pesky</span> <span id="L233" class="LineNr">233 </span><span class="Comment">//: failbit and badbit. Just avoid eof() and use this helper instead.</span> <span id="L234" class="LineNr">234 </span><span class="Delimiter">:(code)</span> -<span id="L235" class="LineNr">235 </span><span class="Normal">bool</span> has_data<span class="Delimiter">(</span>istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L235" class="LineNr">235 </span><span class="Normal">bool</span> <a href='001help.cc.html#L235'>has_data</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L236" class="LineNr">236 </span> <span class="Identifier">return</span> in && !in<span class="Delimiter">.</span>eof<span class="Delimiter">();</span> <span id="L237" class="LineNr">237 </span><span class="Delimiter">}</span> <span id="L238" class="LineNr">238 </span> |