I have methods that currently take
const char*
and an encoding. Like so:
foo(const char* text,text_encoding::utf8)
That's fine for utf8 and latin1, etc
But what if you want utf16 (wchar_t?) or utf32 (no intrinsic type, but i use int32_t)
What if there are others, like some kind of binary businesses that's utf8? My encoders don't care - they take a void*
Should I take a
const void*
here? I really hate it. But I also hate the idea of limiting the types it can be via a union because I just don't know what types of encodings people may want to use down the road.
I mean, I could do like
typedef void* encoded_text_t;
(I don't like that name, but I'd take suggestions).
Does anyone have a better idea?
Keep in mind, the STL is off limits to me. I'm on embedded.
What I have tried:
not really applicable here.
I've put everything in the first box.