lisitsyn / tapkee

A flexible and efficient С++ template library for dimension reduction
http://tapkee.lisitsyn.me
BSD 3-Clause "New" or "Revised" License
231 stars 58 forks source link

Simply CLI defaults function templates. #87

Closed iglesias closed 5 months ago

iglesias commented 5 months ago

Updated, @lisitsyn, deducing the template param.

While reviewing the change here just came up that could be better passing string_view. I can give a go to that soon if so.

lisitsyn commented 5 months ago

I like that it makes it hard to mistype the default value!

iglesias commented 5 months ago

While reviewing the change here just came up that could be better passing string_view. I can give a go to that soon if so.

As I was on my way to compare the generated assembler via minimal examples with std::string and std::string_view, I have arrived at doing it in constexpr.

The analysis is an overkill for the problem at hand - I don't expect any real perf overhead from passing the options strings by value. Still, I just find it fun to analyze and in this case it could add compile-time tests of this from C++23.