Are the methods in the <cstring> applicable for string class too?

I've tried out using memcpy() method to strings but was getting a "no matching function call" although it works perfectly when I use an array of char[].
Can someone explain why?
www.cplusplus.com/reference/cstring/memcpy/
std::string is not a c-string, so you cannot apply c-string operations to std::string. This is simple.

Additionally, memcpy should never be aplied to anything which is not TriviallyCopiable (so almost all C++ standard library classes are out), or you will ahve serious problems.
Topic archived. No new replies allowed.