MCPcopy Create free account
hub / github.com/Barracuda09/SATPI / CharPointerArray

Method CharPointerArray

src/base/CharPointerArray.h:34–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32 // =====================================================================
33 template<class Container>
34 CharPointerArray(const Container &container) {
35 // Allocate Size of container + null terminator
36 _data = new char *[container.size() + 1];
37 int counter = 0;
38 for (const std::string &str : container) {
39 // Allocate Size of str + null terminator
40 _data[counter] = new char [str.size() + 1];
41 // Copy str + null terminator
42 std::strcpy(_data[counter], str.c_str());
43 ++counter;
44 }
45 // null terminator
46 _data[counter] = nullptr;
47 }
48
49 virtual ~CharPointerArray() {
50 for (int i = 0; _data[i] != nullptr; ++i) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected