EleFits  5.3.0
A modern C++ API on top of CFITSIO
Loading...
Searching...
No Matches
Public Attributes | List of all members
CStrArray Struct Reference

#include <StringUtils.h>

Detailed Description

A helper structure to safely convert a std::vector<std::string> to char**.

See also
to_char_ptr for a single string
Example
To call some function f(char**) with a vector of strings v, do:
CStrArray a(v);
f(a.data());
A helper structure to safely convert a std::vector<std::string> to char**.
Definition: StringUtils.h:75
Warning
The CStrArray owns the data, and must therefore not be destroyed before the user function ends.

Public Member Functions

Construction
template<typename T >
 CStrArray (const T begin, const T end)
 Create from begin and end iterators.
 
 CStrArray (const std::vector< std::string > &data)
 Create from a vector.
 
 CStrArray (const std::initializer_list< std::string > &data)
 Create from an initializer_list.
 
Properties
std::size_t size () const
 The number of elements.
 
Element access
char ** data ()
 Get the data as a non-const char **.
 

Public Attributes

std::vector< char * > c_str_vector
 A vector of char*. More...
 
std::vector< std::unique_ptr< char[]> > smart_ptr_vector
 A vector of smart pointers to char[]. More...
 

The documentation for this struct was generated from the following file: