#ifndef UNICODE
#define UNICODE
#endif
#include <iostream>
#include <queue>
#include <stdio.h>
#include <Windows.h>
#include <string>
using namespace std;
int __cdecl main()
{
std::queue<std::basic_string<TCHAR>> results;
results.push(TEXT("Hello world! ♥☻☺"));
wcout<<results.front();
delete [] results.front();
system("pause");
return 0;
}
Error 1 error C2440: 'delete' : cannot convert from 'std::basic_string<_Elem,_Traits,_Ax>' to 'void *' C:\Users\Tomek\Documents\Visual Studio 2010\Solutions\clean_rough_draft\clean_rough_draft\main.cpp 20 1 clean_rough_draft
Why such error is being thrown and how to fix it?
#include <string>- Seth Carnegiedelete [] results.front();? - Blastfurnaceresults.pop()to remove processed elements.... - Tony Delroydelete[], and that's inside the destructor of a class. In this case, that destructor isstd::queue<std::string>::~queue(). - MSalters