I'll be reviewing your implementation mainly, leaving the algorithm to another one.

 

 1. **using the whole namespace is generally considered a bad practice** although in this small example there's very little chance of troubles.
 2. `LogFileName` **need not be global:** it's only used in `main`.
 3. **Avoid global variables**.  
 4. `ToString<T>` **is not needed**: since C++11 there's `std::to_string`, which also covers `double` types.
 5. `unit` **may be initialized much better** by using `std::vector<std::string> units {elem1, elem2, elem3, ..., elemN}`.  
 6. You may avoid multiple `operator<<` calls with string literals by letting the preprocessor chain them together:

      `outFile << "<!DOCTYPE html>\n"
                 "<meta charset=\"UTF-8\">\n"
                 "<html>\n"
                 "<title>" << sourcePath.filename() << "</title>\n"
                 "<body>\n";`
 7. In `main` you may want to check whether `getline` succeded.  
 8. `Log` **need not be** `global`. See 2 & 3.

## Error handling ##
**Your error handling is awkward**. Having a global object where you store possible errors and making the caller check for some is inefficient and, again, weird.  

If you encounter an error, and your local code cannot do anything about that, either throw an exception (C++-style) or an error code with some related flag set accordingly (C-style). In the first case, you can decide to let the caller handle it (maybe adding some further information) until one of them is able to (or the program is exited) and keep throwing or locally, if you can.