Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

30 lines (16 sloc) 653 Bytes

Considering Correctness

Avoid Typeless Interfaces

Bad Idea:

std::string find_file(const std::string &base, const std::string &pattern);

Better Idea:

std::filesystem::path find_file(const std::filesystem::path &base, const std::regex &pattern);

The above is better but still suffers from having implicit conversions from std::string to std::filesystem::path and back.

Consider using a typesafe library like

Note that stronger typing can also allow for more compiler optimizations.

  • [Sorting in C vs C++](Sorting in C vs C++.pdf)
You can’t perform that action at this time.