c++: exile_launch(): Correct std::enable_if logic if type is a ptr
这个提交包含在:
父节点
91858efa51
当前提交
cdc265cedf
@ -119,7 +119,7 @@ inline int do_clone(int (*clonefn)(void *), void *launcharg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename U, typename ... Args>
|
template<typename T, typename U, typename ... Args>
|
||||||
typename std::enable_if_t<std::is_trivially_copyable_v<T>, T> exile_launch(struct exile_policy *policy, U fn, Args && ... args)
|
typename std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, T> exile_launch(struct exile_policy *policy, U fn, Args && ... args)
|
||||||
{
|
{
|
||||||
size_t mapsize = sizeof(T);
|
size_t mapsize = sizeof(T);
|
||||||
T * sharedbuf = (T *) mmap(NULL, mapsize , PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
|
T * sharedbuf = (T *) mmap(NULL, mapsize , PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
|
||||||
@ -145,7 +145,7 @@ typename std::enable_if_t<std::is_trivially_copyable_v<T>, T> exile_launch(struc
|
|||||||
|
|
||||||
|
|
||||||
template<typename T, typename U, typename ... Args>
|
template<typename T, typename U, typename ... Args>
|
||||||
typename std::enable_if_t<!std::is_trivially_copyable_v<T> && std::is_copy_constructible_v<T>, T>
|
typename std::enable_if_t<std::is_pointer_v<T> || (!std::is_trivially_copyable_v<T> && std::is_copy_constructible_v<T>), T>
|
||||||
exile_launch(struct exile_policy *policy, const std::function<size_t (const T &, char *, size_t)> &serializer, const std::function<T(const char *, size_t)> &deserializer, U fn, Args && ... args)
|
exile_launch(struct exile_policy *policy, const std::function<size_t (const T &, char *, size_t)> &serializer, const std::function<T(const char *, size_t)> &deserializer, U fn, Args && ... args)
|
||||||
{
|
{
|
||||||
size_t mapsize = EXILE_MMAP_SIZE;
|
size_t mapsize = EXILE_MMAP_SIZE;
|
||||||
|
正在加载...
在新工单中引用
屏蔽一个用户