#include <locale>
#include <testsuite_hooks.h>
-// Need to explicitly set the state(mbstate_t) to zero.
-// How to do this is not specified by the ISO C99 standard, so we
-// might need to add some operators to make the intuiative case
-// work:
-// w_codecvt::state_type state00;
-// state00 = 0;
-// or, can use this explicit "C" initialization:
-// w_codecvt::state_type state01 = {0, 0};
-// .. except Ulrich says: Use memset. Always use memset. Feel the force...
-void
-zero_state(std::mbstate_t& state)
-{ std::memset(&state, 0, sizeof(std::mbstate_t)); }
-
// Required instantiation
// codecvt<wchar_t, char, mbstate_t>
void test01()
{
using namespace std;
typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
- typedef codecvt_base::result result;
- typedef wchar_t int_type;
- typedef char ext_type;
- typedef char_traits<wchar_t> int_traits;
- typedef char_traits<char> ext_traits;
-
- bool test = true;
- const ext_type* e_lit = "black pearl jasmine tea";
- const ext_type* efrom_next;
- const int_type* i_lit = L"black pearl jasmine tea";
- const int_type* ifrom_next;
- int size = strlen(e_lit);
- ext_type* e_arr = new ext_type[size + 1];
- ext_type* eto_next;
- int_type* i_arr = new int_type[size + 1];
- int_type* ito_next;
locale loc;
const w_codecvt* cvt = &use_facet<w_codecvt>(loc);
VERIFY( !cvt->always_noconv() );
-
- delete [] e_arr;
- delete [] i_arr;
}
int main ()