Cómo convertir la cadena Platform^ en wstring y luego concatenar con una cadena L

Toma lo siguiente:

highestScore->Data( ) // wchar_t *Platform::String::Data     
startMenuItems.push_back( L"Highest score: " ); // startMenu is an array of wstring

¿Cómo hago lo siguiente?

startMenuItems.push_back( L"Highest score: " + highestScore->Data( ) );

Obtuve el siguiente error:

Error no operator "+" matches these operands
operand types are: const wchar_t[16] and const wchar_t*

Termina usándose aquí:

virtual HRESULT CreateTextLayout(
  [in]   const WCHAR * string,
  UINT32  stringLength,
  IDWriteTextFormat * textFormat,
  FLOAT  maxWidth,
  FLOAT  maxHeight,
  [out]  IDWriteTextLayout ** textLayout
) = 0;

para el 1er parámetro...

preguntado el 14 de febrero de 14 a las 01:02

1 Respuestas

Prueba esto:

startMenuItems.push_back(
    std::wstring(L"Highest score: ") + highestScore->Data());

Tu necesitas #include <string>.

Respondido 14 Feb 14, 01:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.