Remove std::enable_if<std::is_member_function_pointer> (#4139)

This commit is contained in:
A Cœur 2022-11-12 01:18:17 +08:00 committed by GitHub
parent 9e06cf8f2e
commit 2aa46f840c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 13 deletions

View File

@ -177,7 +177,7 @@ bool tr_sys_path_copy(char const* src_path, char const* dst_path, struct tr_erro
*/
bool tr_sys_path_exists(char const* path, struct tr_error** error = nullptr);
template<typename T, typename = std::enable_if<std::is_member_function_pointer<decltype(&T::c_str)>::value>>
template<typename T, typename = decltype(&T::c_str)>
bool tr_sys_path_exists(T const& path, struct tr_error** error = nullptr)
{
return tr_sys_path_exists(path.c_str(), error);
@ -209,11 +209,7 @@ bool tr_sys_path_is_relative(std::string_view path);
*/
bool tr_sys_path_is_same(char const* path1, char const* path2, struct tr_error** error = nullptr);
template<
typename T,
typename U,
typename = std::enable_if<std::is_member_function_pointer<decltype(&T::c_str)>::value>,
typename = std::enable_if<std::is_member_function_pointer<decltype(&U::c_str)>::value>>
template<typename T, typename U, typename = decltype(&T::c_str), typename = decltype(&U::c_str)>
bool tr_sys_path_is_same(T const& path1, U const& path2, struct tr_error** error = nullptr)
{
return tr_sys_path_is_same(path1.c_str(), path2.c_str(), error);
@ -267,11 +263,7 @@ std::string_view tr_sys_path_dirname(std::string_view path);
*/
bool tr_sys_path_rename(char const* src_path, char const* dst_path, struct tr_error** error = nullptr);
template<
typename T,
typename U,
typename = std::enable_if<std::is_member_function_pointer<decltype(&T::c_str)>::value>,
typename = std::enable_if<std::is_member_function_pointer<decltype(&U::c_str)>::value>>
template<typename T, typename U, typename = decltype(&T::c_str), typename = decltype(&U::c_str)>
bool tr_sys_path_rename(T const& src_path, U const& dst_path, struct tr_error** error = nullptr)
{
return tr_sys_path_rename(src_path.c_str(), dst_path.c_str(), error);
@ -290,7 +282,7 @@ bool tr_sys_path_rename(T const& src_path, U const& dst_path, struct tr_error**
*/
bool tr_sys_path_remove(char const* path, struct tr_error** error = nullptr);
template<typename T, typename = std::enable_if<std::is_member_function_pointer<decltype(&T::c_str)>::value>>
template<typename T, typename = decltype(&T::c_str)>
bool tr_sys_path_remove(T const& path, struct tr_error** error = nullptr)
{
return tr_sys_path_remove(path.c_str(), error);
@ -564,7 +556,7 @@ std::string tr_sys_dir_get_current(struct tr_error** error = nullptr);
*/
bool tr_sys_dir_create(char const* path, int flags, int permissions, struct tr_error** error = nullptr);
template<typename T, typename = std::enable_if<std::is_member_function_pointer<decltype(&T::c_str)>::value>>
template<typename T, typename = decltype(&T::c_str)>
bool tr_sys_dir_create(T const& path, int flags, int permissions, struct tr_error** error = nullptr)
{
return tr_sys_dir_create(path.c_str(), flags, permissions, error);