Copy a std::string
into a std::unique_ptr<char[]>
.
Internally used to work around non-const correctness of CFITSIO: when a function expects a char
* instead of a const char*
, string::c_str()
cannot be used.
- See also
CStrArray
for multiple strings
- Example
- To call some function
f(char *)
with a string s
, do:
std::unique_ptr< char[]> toCharPtr(const std::string &str)
Copy a std::string into a std::unique_ptr<char[]>.