title: How to implement Casts utility namespace
body: <p>Say I generate a <code>Casts</code> namespace which will hold numerous casts functions:</p>
  
  <pre><code>namespace Casts
  {
      // To string
      bool Cast(bool bValue,                 string&amp; res);
      bool Cast(int intValue,                string&amp; res);
      bool Cast(float floatValue,            string&amp; res);
      bool Cast(const wstring&amp; str,          string&amp; res);
  
      // From string
      bool Cast(const string&amp; strVal, bool&amp; res);
      bool Cast(const string&amp; strVal, int&amp; res);
      bool Cast(const string&amp; strVal, long&amp; res);
      bool Cast(const string&amp; strVal, float&amp; res);
  
      // And lots of other casting functions of different types 
  }
  </code></pre>
  
  <p>I really like <a href="http://www.boost.org/doc/libs/1_56_0/doc/html/boost_lexical_cast.html" rel="nofollow">boost:lexical_cast</a> approach. For example:</p>
  
  <pre><code>bool Cast(int intValue, string&amp; res)
  {
      bool bRes = true;
      try { res = lexical_cast&lt;string&gt;(intValue); }
      catch(bad_lexical_cast &amp;) { bRes = false; }
      return bRes;
  }
  </code></pre>
  
  <p>My question, are there any other possible approaches to implement <code>Casts</code> in an elegant, uniform and robust manner. The ideal way for me is to have a native lightweight approach. </p>