I am implementing some compile-time check which should base on a CSV file and I am trying to load it a bit hacky way:
constexpr std::variant<int, const char*> test[] = {
#include "data.csv"
};
where "data.csv" is:
"a","b","c"
1,"xyz",1
2,"abc",0
3,"def",1
Obviously, there is a problem with the lack of commas at the end of each line. Is there a way to add a comma with C++ (or even Boost) preprocessor at the end of each line?
I know I could add some token at the end of each line and then replace it with #define, but I would like to avoid it for the sake of clarity. Can one replace a \n character with #define?