title: String stream wrapper operator help needed
body: <p>I found this beautiful little helper on this site:
  <a href="https://stackoverflow.com/questions/12261915/howto-throw-stdexceptions-with-variable-messages">Howto throw std::exceptions with variable messages?</a></p>
  
  <pre><code>class Formatter
  {
  public:
    Formatter() {}
    ~Formatter() {}
  
    template &lt;typename Type&gt;
    Formatter &amp; operator &lt;&lt; (const Type &amp; value)
    {
        stream_ &lt;&lt; value;
        return *this;
    }
  
    std::string str() const         { return stream_.str(); }
    operator std::string () const   { return stream_.str(); }
  
    enum ConvertToString 
    {
        to_str
    };
    std::string operator &gt;&gt; (ConvertToString) { return stream_.str(); }
  
  private:
    std::stringstream stream_;
  
    Formatter(const Formatter &amp;);
    Formatter &amp; operator = (Formatter &amp;);
  };
  </code></pre>
  
  <p>It can be used like</p>
  
  <pre><code>    std::string foo(Formatter() &lt;&lt; "foo" &lt;&lt; 42);
  </code></pre>
  
  <p>To allow enabling/disabling of the stream input I extended the class with</p>
  
  <pre><code>bool enabled;
  
  enum class status {
    active, inactive
  };
  
  Formatter&amp; operator &lt;&lt; (status s)
  {
    if (s == status::active) enabled = true;
    if (s == status::inactive) enabled = false;
    return *this;
  }
  </code></pre>
  
  <p>and changed the input template to <code>if (enabled) stream_ &lt;&lt; value;</code></p>
  
  <p>Now I can do</p>
  
  <pre><code>std::string optional = "";
  std::string foo(Formatter()
    &lt;&lt; "foo"
    &lt;&lt; (optional.empty() ? Formatter::status::inactive : Formatter::status::active)
    &lt;&lt; "bar" &lt;&lt; optional
    &lt;&lt; Formatter::status::active
    &lt;&lt; "!");
  </code></pre>
  
  <p>Now I´m looking for a way to get rid of <code>status</code> and use <code>Formatter::inactive</code> directly instead.</p>