1

Take the following:

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

How do I do the following?

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

I get the following error:

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

It ends up getting used here:

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

for the 1st parameter...

1 Answer 1

4

Try this:

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

You need to #include <string>.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.