title: Using 'auto' type deduction - how to find out what type the compiler deduced?
body: <p>How can I find out what type the compiler deduced when using the <code>auto</code> keyword?</p>
  
  <p>Example 1: Simpler</p>
  
  <pre><code>auto tickTime = 0.001;
  </code></pre>
  
  <p>Was this deduced as a <code>float</code> or a <code>double?</code></p>
  
  <p>Example 2: More complex (and my present headache):</p>
  
  <pre><code>typedef std::ratio&lt;1, 1&gt; sec;
  std::chrono::duration&lt;double, sec &gt; timePerTick2{0.001};
   auto nextTickTime = std::chrono::high_resolution_clock::now() + timePerTick2;
  </code></pre>
  
  <p>What type is <code>nextTickTime</code>?</p>
  
  <p>The problem I'm having is when I try to send <code>nextTickTime</code> to <code>std::cout</code>. I get the following error:</p>
  
  <pre><code>./main.cpp: In function ‘int main(int, char**)’:
  ./main.cpp:143:16: error: cannot bind ‘std::basic_ostream&lt;char&gt;’ lvalue to ‘std::basic_ostream&lt;char&gt;&amp;&amp;’
    std::cout &lt;&lt; std::setprecision(12) &lt;&lt; nextTickTime &lt;&lt; std::endl; // time in seconds
              ^
  In file included from /usr/include/c++/4.8.2/iostream:39:0,
               from ./main.cpp:10:
  /usr/include/c++/4.8.2/ostream:602:5: error:   initializing argument 1 of ‘std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::operator&lt;&lt;(std::basic_ostream&lt;_CharT, _Traits&gt;&amp;&amp;, const _Tp&amp;) [with _CharT = char; _Traits = std::char_traits&lt;char&gt;; _Tp = std::chrono::time_point&lt;std::chrono::_V2::system_clock, std::chrono::duration&lt;double, std::ratio&lt;1l, 1000000000l&gt; &gt; &gt;]’
   operator&lt;&lt;(basic_ostream&lt;_CharT, _Traits&gt;&amp;&amp; __os, const _Tp&amp; __x)
  </code></pre>