Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
2 answers
117 views

convert c-style-sting to std::string inside initialization list of a constructor

Is it safe to convert char* to std::string inside initialization list of a constructor like below: class MyClass{ public: MyClass(){} MyClass( char*char_Ptr_Definition_File ,char*...
Megidd's user avatar
  • 7,896
10 votes
3 answers
19k views

How to elegantly initialize vector<char *> with string literal?

The problem comes from an exercise on C++ Primer 5th Edition: Write a program to assign the elements from a list of char* pointers to C-style character strings to a vector of strings. -----------...
Warbean's user avatar
  • 547