title: Implementing basic_string<unsigned char> for ISO 8859-1
body: <p><strong>Background:</strong></p>
  <p>I'm a C programmer, and I've just decided to play around with C++.</p>
  <p><strong>Objective:</strong></p>
  <p>Create a class to read ISO 8859-1 characters as a string using std::basic_string. I know I could just use a mapping function within std::string, but I wanted to try this way for learning reasons.</p>
  <p><strong>Problem:</strong></p>
  <p>I've created a class that extends from char_traits and a class that implements basic_string. Right now I'm trying to create the constructor.
  The constructor should accept a const char pointer and allocate space for it.</p>
  <p>Based on <a href="http://www.cplusplus.com/reference/string/basic_string/basic_string/" rel="nofollow noreferrer">this</a>, this constructor already exists:</p>
  <pre><code>basic_string (const charT* s, const allocator_type&amp; alloc = allocator_type());
  </code></pre>
  <p>And it's defined as:</p>
  <blockquote>
  <p>from c-string</p>
  <pre><code>Copies the null-terminated character sequence (C-string) pointed by s.
  The length is determined by calling traits_type::length(s).&quot;
  </code></pre>
  </blockquote>
  <p>So I assumed I could just reuse that constructor, passing the correct arguments (in this case, unsigned char instead of char), but either I don't know how to use default parameters properly, or the constructor doesn't exist.</p>
  <p>I'm not sure if this is the correct approach, so any tips/hint on how to do this are welcome.</p>
  <p><strong>Error:</strong></p>
  <pre><code>test.cpp: In constructor ‘ISO_8859_1_String::ISO_8859_1_String(const char*)’:
  test.cpp:18:72: error: no matching function for call to ‘ISO_8859_1_String::ISO_8859_1_String(const unsigned char*, NULL)’
  test.cpp:18:72: note: candidates are:
  test.cpp:16:5: note: ISO_8859_1_String::ISO_8859_1_String(const char*)
  test.cpp:16:5: note:   candidate expects 1 argument, 2 provided
  test.cpp:14:7: note: ISO_8859_1_String::ISO_8859_1_String(const ISO_8859_1_String&amp;)
  test.cpp:14:7: note:   candidate expects 1 argument, 2 provided
  </code></pre>
  <p><strong>Code:</strong></p>
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  class ISO_8859_1_Char_Traits : public char_traits&lt;unsigned char&gt;{
    public: 
      // Simple length implementation
      static size_t length (const unsigned char* s){
        size_t i = 0;
        while (s[i++] != 0x00){};
        return i;
      }
  };
  
  class ISO_8859_1_String : public basic_string&lt;unsigned char, ISO_8859_1_Char_Traits, allocator&lt;unsigned char&gt; &gt;{
    public:
      ISO_8859_1_String(const char* s){
        ISO_8859_1_String(reinterpret_cast&lt;const unsigned char*&gt;(s), NULL);
     }
  };
  
  int main(){
    ISO_8859_1_String* test = new ISO_8859_1_String(&quot;test&quot;);
    
    return 1;
  }
  </code></pre>