remove(str.begin(), str.end(), ' '); is not working properly(I am using visual studio 2012)

delete a character from a string in c++
remove special characters from string c
remove substring from string c++
remove first character from string - c++
how to delete a element from a string
remove a letter from string in c++
removing an element from a string in cpp
remove last character from string c++