What is the best way to convert from a std::array<char, N> to a std::string?
I have tried producing a template method but have had no luck. I think my C++ skills just aren’t up to scratch. Is there an idiomatic way of doing this in C++?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I won’t say it is the “best way”, but a way is to use
std::string‘s iterator constructor: