So, I would like to stop using char* and char[ size ] to allocate and pass around strings. Instead I want to use a string class.
The string class allocates some memory on the stack (like 25 characters worth or so) to optimize the use of small strings. I have written a class that works the same, however, it also allows you to set the amount of 'stack allocated memory' using a template parameter. Like so:
MyString< SIZE > string;
This allows it to function just as if you were pre-allocating a char array like so:
char string[ SIZE ];
However, when I return a char array I just use a char*, and I don't need to know how much memory was allocated for that buffer. With MyString, when I return it I need to specify exactly how much memory was allocated for it, and it's a pain in the ass! Something like this:
const MyString< SIZE >& GetFaceName( );
Which is ridiculous, since I always have to know its exact size. How can I wrap char arrays into a class and make it not suck so bad? The only thing I can think of is to maybe have MyString inherit an interface IMyString and return that. But I'm not sure if that's the best way to solve this problem.
ALSO: Hope your Christmas was good!