EleFits  5.3.1
A modern C++ API on top of CFITSIO
Loading...
Searching...
No Matches

◆ to_char_ptr()

std::unique_ptr< char[]> to_char_ptr ( const std::string str)

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:
f(to_char_ptr(s).get());
std::unique_ptr< char[]> to_char_ptr(const std::string &str)
Copy a std::string into a std::unique_ptr<char[]>.