| 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) { |
nothing calls this directly
no outgoing calls
no test coverage detected