12 : ptr_{opendir(name)} {
14 throw std::runtime_error{
"Unable to open directory."};
18 auto read() {
return readdir(ptr_.get()); }
20 void rewind() { rewinddir(ptr_.get()); }
23 struct destructor final {
25 void operator()(T t) {
30 std::unique_ptr<DIR, destructor> ptr_;
33 inline auto list_directory(
const char* name) {
35 std::vector<std::string> ret{};
37 while (
const auto ptr = directory.read()) {
38 ret.emplace_back(ptr->d_name, ptr->d_name + ptr->d_namlen);