title: get value_type of dereferencable types
body: <p>I how would I achieve the following for any derefernable type?</p>
  
  <p>I find my current solution lacking since I need to do a class template specialization for every type I want it to work with:</p>
  
  <pre><code>template&lt;typename T&gt;
  struct get_value_type
  {
      typedef typename T::value_type value_type;
  };
  
  template&lt;typename E&gt;
  struct get_value_type&lt;std::unique_ptr&lt;E&gt;&gt;
  {
      typedef typename E::value_type value_type;
  };  
  
  template&lt;typename E&gt;
  struct get_value_type&lt;std::shared_ptr&lt;E&gt;&gt;
  {
      typedef typename E::value_type value_type;
  };  
  
  template&lt;typename E&gt;
  struct get_value_type&lt;boost::optional&lt;E&gt;&gt;
  {
      typedef typename E::value_type value_type;
  };
  </code></pre>
  
  <p>I've tried the something along the ways of, which doesn't work.</p>
  
  <pre><code>template&lt;typename T, typename IsIndirect = false_type&gt;
  get_value_type
  {
      typedef typename T::value_type value_type;     
  }
  
  template&lt;typename T&gt;
  struct get_value_type&lt;T, true_type&gt;
  {
       typedef decltype(*boost::declval&lt;E&gt;())::value_type value_type; 
  };
  
  typedef get_value_type&lt;T, is_indirect&lt;T&gt;::type&gt; value_type;
  </code></pre>