I have a class PDCstr that stores a null-terminated array of chtypes. A chtype is a 32bit formated character that can be represented in the screen. I use this class as a helper class for PDCurses (a portable curses implementation) daily usage.

PDCstr, among other things, defines two subscript operator overloads and an observer function:
Code:
chtype& operator[] (const size_type idx) { return chtstr_[idx]; }
const chtype& operator[] (const size_type idx) const { return chtstr_[idx]; }
size_type size() const { return str_.size() );
chtstr_ and str_ are defined as:
Code:
private:
    std::string str_;
    boost::shared_array<chtype> chtstr_;
size_type above is currently being defined as:
Code:
public:
    typedef size_t size_type;
I'm not sure if my typedef is the correct one anymore. I'm divided between what I have now and these two:
Code:
typedef std::string::size_type size_type;

typedef std::ptrdiff_t size_type //boost way (and then assert as boost does)
As a final note, I'm using the std::string (which is initialized from a constructor parameter) to build the null-terminated array of 32bit characters. That is, the array is a character-by-character 32bit representation of the 8bit std::string.