I have a std::vector<const char*> which I populate by .push_back("something"). How to delete contents not including std::string‘s header? delete segfaults, and std::free needs void* and it "cannot initialize [..] with an lvalue of type ‘const char *’".
>Solution :
String literals have static storage duration. You may not delete them using the operator delete. String literals will be alive until the program ends,
You may delete what was created using the operator new.
You can just erase all or selected elements of the vector or clear it entirely.