I'm creating a custom locale by deriving from std::codecvt
. Most of the methods I'm supposed to implement are pretty straight forward, except for this std::mbstate_t
. On my compiler, vs2010, it's declared as an int
. But, google tells me it's a POD type, it's sometimes a union (of what I don't know) or a struct (again I can't find it).
As I understand it, std::mbstate_t
is a placeholder for partial convertions. And, I think, it comes into play when std::codecvt::on_out()
requires more space to write the output, which in turn will call std::codecvt::do_unshift()
. Please correct me if my assumptions are wrong.
I've read another post about storing pointers, though the post doesn't have an adequate answer. I've also read this example which presumes it to be a 32bit type although the standard states an int
to be no less than 16bits.
My question. What can I safely store in std::mbstate_t? Can I safely replace it with another type? The answer to the above post suggests replacing it, but the following comment says otherwise.