Note that there are some explanatory texts on larger screens.

plurals
  1. POOverloaded Function not being Used:
    text
    copied!<p>I have two functions that I have overloaded for my debug class:</p> <pre><code> template&lt;class IteratorT&gt; inline debug&amp; operator()(const std::string&amp; name, IteratorT begin, IteratorT end) { _stream &lt;&lt; indent(internal) &lt;&lt; "g&lt; " &lt;&lt; name &lt;&lt; " : [ "; for (auto i = begin; i != end; i++) _stream &lt;&lt; (*i) &lt;&lt; " "; _stream &lt;&lt; "] &gt;" &lt;&lt; std::endl; return *this; } </code></pre> <p>And</p> <pre><code> inline debug&amp; operator()(const std::string&amp; name, std::vector&lt;uint8_t&gt;::const_iterator begin, std::vector&lt;uint8_t&gt;::const_iterator end) { _stream &lt;&lt; indent(internal) &lt;&lt; "u8&lt; " &lt;&lt; name &lt;&lt; " : [ " &lt;&lt; std::hex; std::copy(begin, end, std::ostream_iterator&lt;uint32_t&gt;(_stream, " ")); _stream &lt;&lt; "] &gt;" &lt;&lt; std::endl; return *this; } </code></pre> <p>Here is a snipped of how it's used:</p> <pre><code>int main() { debug log; std::vector&lt;uint8_t&gt; vec; vec.push_back(0xde); vec.push_back(0xad); vec.push_back(0xc0); vec.push_back(0xde); log("vec", vec.begin(), vec.end()); } </code></pre> <p>The output is (since it's not being printed as hex characters I ommited the unformatted result):</p> <pre><code>g&lt; "vec" : [ ... ] &gt; </code></pre> <p>Instead of</p> <pre><code>u8&lt; "vec" : [ de ad c0 de ] &gt; </code></pre> <p>For some reason the compiler isn't picking the correct, overloaded function.</p> <pre><code>$ g++47 --version g++47 (GCC) 4.7.0 20120224 (experimental) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload