diff --git a/include/EASTL/list.h b/include/EASTL/list.h index 8060caa2..ae356913 100644 --- a/include/EASTL/list.h +++ b/include/EASTL/list.h @@ -1571,7 +1571,9 @@ namespace eastl template inline void list::swap(this_type& x) { - if(internalAllocator() == x.internalAllocator()) // If allocators are equivalent... + if constexpr (is_empty_v) + DoSwap(x); + else if (internalAllocator() == x.internalAllocator()) // If allocators are equivalent... DoSwap(x); else // else swap the contents. {