That's the only thing I can think of. The thing is sentient.
I have a struct as follows:
struct NumPair
{
wchar_t *pFirst, *pSecond;
int count;
with ctor, copy assignment and construction as
NumPair( wchar_t *pfirst, wchar_t *psecond, int count = 0)
NumPair( const NumPair& np )
NumPair& operator=( const NumPair& np )
This is an extension of my last problem in which I was asking for a way to sort a list of characters pointers with them containing special (german) characters such as ü, ä, ö
.
The solution seems to be using wide character types, but the compiler is throwing over a hundred errors of conversion for some reason.
Sample input:
// dict_ is a container of NumPairs.
dict_.push_back( NumPair ( "anfangen", "to begin, to start" ) );
The compiler is complaining that it cannot convert a const char *
to a wchar_t
. Fine enough, I change the push_back to say
dict_.push_back( NumPair ( wchar_t("anfangen"), wchar_t("to begin, to start") ) );
Compiler error: Cannot find a NumPair ctor, that accepts all arguments.
What. The. Hell. I tried a full rebuild, thinking my VSC++10 is mucking up. Nope, guess not.
What am I doing wrong?
CODE
The ctor, assignment and copy construction are all deep copies of the wchar_t pointers like below.
wchar.h is included.
NumPair( wchar_t *pfirst, wchar_t *psecond, int count = 0)
: count(count)
{
size_t s1, s2;
s1 = wcslen(pfirst);
s2 = wcslen(psecond);
pFirst = new wchar_t[s1];
pSecond = new wchar_t[s2];
wcscpy(pFirst, pfirst);
wcscpy(pSecond, psecond);
}