posix: prefer invoke over manual calls

This commit is contained in:
Danny Robson 2019-02-24 21:34:27 +11:00
parent ee96cbb5da
commit 6dadff769e

View File

@ -3,13 +3,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
* Copyright 2015-2019 Danny Robson <danny@nerdcruft.net>
*/
#ifndef __UTIL_POSIX_DIR_HPP
#define __UTIL_POSIX_DIR_HPP
#pragma once
#include "except.hpp"
#include "../debug.hpp"
#include <cerrno>
#include <dirent.h>
@ -34,7 +34,7 @@ namespace cruft::posix {
rewind ();
for (dirent *cursor; errno = 0, cursor = readdir (m_handle); )
func (cursor->d_name, args...);
std::invoke (func, args..., cursor->d_name);
error::try_code ();
}
@ -48,5 +48,3 @@ namespace cruft::posix {
DIR *m_handle;
};
}
#endif