ben-strasser / fast-cpp-csv-parser

fast-cpp-csv-parser
BSD 3-Clause "New" or "Revised" License
2.11k stars 440 forks source link

Pass a variable as separator #62

Closed arfeo closed 6 years ago

arfeo commented 6 years ago

Is there any way to pass a char variable as a separator? Thanks.

dallaires commented 6 years ago

Since the separator is pass over a template, the value must be known at compile time. You may pass a char if it is a constexpr. One way to work around would be to use a factory or an abstract factory that return the desired parser with the correct separator.

ben-strasser commented 6 years ago

There is no way in the provided interface. The reason is that it seems like a very awkward requirement to me to specify the separator at runtime and thus the code was not written with this scenario in mind. Changing it in the code is also not so easy. The separator is part of the quote_policy. So I am afraid that the answer is a simple "no". Sorry.