I'm trying to store the address returned by the algorithm remove function in C++ in a variable, but have failed to find one. I've tried int* and char*. Both threw errors.
Using Visual Studio CL, the error is:
error C2440: '=': cannot convert from '_FwdIt' to 'int *'
Using MinGW, the error is:
cannot convert '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' to 'int*' in assignment
How should I store such an address?
The code I'm trying:
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main (void) {
string line ("This is an example sentence.");
int* newEOL;
newEOL = remove(line.begin(), line.end(), ' ');
printf("%p\n", newEOL);
}