title: Why std::is_same does not work?
body: <p>My code snippet is:</p>
  
  <pre><code>namespace serialization
  {
      struct output_stream
      {
          /////
          void write(const void* data, size_t size)
          {
              const byte_t* p = static_cast&lt;const byte_t*&gt;(data);
  
              size_t old_size = buffer_.size();
              buffer_.resize(old_size + size);
              memcpy(buffer_.data() + old_size, p, size);
          }
      }
  
      struct input_stream
      {
          ///////
  
          void read(void* to, size_t size)
          {
              assert(cur_ + size &lt;= end_);
              memcpy(to, cur_, size);
              cur_ += size;
          }
      }
  }
  
  template &lt;class stream_t&gt;
  void serialize(not_pod_struct&amp; r, stream_t stream)
  {
      if (std::is_same&lt;stream_t, serialization::output_stream&gt;::value)
      {
          stream.write(&amp;r, sizeof(r));
      }
      else if (std::is_same&lt;stream_t, serialization::input_stream&gt;::value)
      {
          not_pod_struct* buf = new not_pod_struct[sizeof(not_pod_struct)];
          stream.read(buf, sizeof(not_pod_struct));
          r = *buf;
      }
      else 
      {
          throw std::invalid_argument("stream_t is not a stream.");
      }
  }
  
  template&lt;class T&gt;
  typename enable_if&lt;!is_pod&lt;T&gt;::value, void&gt;::type
  read(input_stream &amp; input_stream, T &amp; non_pod_struct)
  {
      serialize(non_pod_struct, input_stream);
  }
  
  template&lt;class T&gt;
  typename enable_if&lt;!is_pod&lt;T&gt;::value, void&gt;::type
  write(output_stream &amp; output_stream, T &amp; non_pod_struct)
  {
      serialize(non_pod_struct, output_stream);
  }
  </code></pre>
  
  <p>I have errors:</p>
  
  <pre><code>Error   1   error C2039: 'read' : is not a member of 'serialization::output_stream'
  Error   2   error C2039: 'write' : is not a member of 'serialization::input_stream'
  </code></pre>
  
  <p>This is strange. I do not understand why these errors happen.</p>