Skip to content

Commit c1e8868

Browse files
authored
Merge pull request #800 from trcrsired/master
mutex is an alias if the mutex itself is movable
2 parents 7dd72df + 82116c8 commit c1e8868

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/fast_io_core_impl/io_lockable.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ struct basic_general_io_lockable_nonmovable
4949
}
5050
else
5151
{
52-
::std::destroy_at(__builtin_addressof(handle));
53-
::std::construct_at(__builtin_addressof(handle), ::std::forward<Args>(args)...);
52+
this->handle = T(::std::forward<Args>(args)...);
5453
}
5554
}
5655
constexpr void close() noexcept(noexcept(handle.close()))

include/fast_io_hosted/threads/mutex/impl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ using native_mutex =
3737
;
3838

3939
template <typename Mutex>
40-
using basic_mutex_movable = ::fast_io::basic_general_mutex_movable<Mutex, ::fast_io::native_global_allocator>;
40+
using basic_mutex_movable = ::std::conditional_t<::std::movable<Mutex>, Mutex,
41+
::fast_io::basic_general_mutex_movable<Mutex, ::fast_io::native_global_allocator>>;
4142
using native_mutex_movable = ::fast_io::basic_mutex_movable<native_mutex>;
4243

4344
template <typename T>

0 commit comments

Comments
 (0)