std::string vs string in c++ [duplicate]

As the other answer already stated, using std:: is necessary unless you import either the whole std namespace or std::string (see below).

In my opinion it’s nicer to use std::string instead of string as it explicitly shows that it’s a std::string and not some other string implementation.

If you prefer to write just string though, I’d suggest you to use using std::string; instead of using namespace std; to only import the things into the global namespace that you actually require.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)